Rev 5163 | Rev 8069 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5159 | IgorA | 1 | use32 |
8062 | IgorA | 2 | org 0 |
5159 | IgorA | 3 | db 'MENUET01' |
8062 | IgorA | 4 | dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
5159 | IgorA | 5 | |
8062 | IgorA | 6 | include '../../../../../proc32.inc' |
7 | include '../../../../../macros.inc' |
||
8 | include '../../../../../KOSfuncs.inc' |
||
9 | include '../../../../../develop/libraries/box_lib/load_lib.mac' |
||
10 | include '../../../../../dll.inc' |
||
5159 | IgorA | 11 | include '../opengl_const.inc' |
12 | |||
13 | @use_library |
||
14 | |||
15 | align 4 |
||
16 | start: |
||
17 | load_library name_tgl, cur_dir_path, library_path, system_path, \ |
||
18 | err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
||
8062 | IgorA | 19 | cmp eax,SF_TERMINATE_PROCESS |
5159 | IgorA | 20 | jz button.exit |
21 | |||
8062 | IgorA | 22 | mcall SF_SET_EVENTS_MASK,0x27 |
5159 | IgorA | 23 | |
24 | stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
||
25 | stdcall [glEnable], GL_DEPTH_TEST |
||
5163 | IgorA | 26 | stdcall [glClearColor], 0.2,0.0,0.2,0.0 |
5159 | IgorA | 27 | |
28 | call draw_3d |
||
29 | |||
30 | align 4 |
||
31 | red_win: |
||
32 | call draw_window |
||
33 | |||
8062 | IgorA | 34 | align 16 |
5159 | IgorA | 35 | still: |
8062 | IgorA | 36 | mcall SF_CHECK_EVENT |
5159 | IgorA | 37 | cmp al,1 |
38 | jz red_win |
||
39 | cmp al,2 |
||
40 | jz key |
||
41 | cmp al,3 |
||
42 | jz button |
||
43 | jmp still |
||
44 | |||
45 | align 4 |
||
46 | draw_window: |
||
47 | pushad |
||
8062 | IgorA | 48 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
5159 | IgorA | 49 | |
50 | mov edx,0x33ffffff ;0x73ffffff |
||
8062 | IgorA | 51 | mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
52 | call [kosglSwapBuffers] |
||
5159 | IgorA | 53 | |
8062 | IgorA | 54 | mcall SF_REDRAW,SSF_END_DRAW |
5159 | IgorA | 55 | popad |
56 | ret |
||
57 | |||
58 | align 4 |
||
59 | key: |
||
8062 | IgorA | 60 | mcall SF_GET_KEY |
5159 | IgorA | 61 | |
62 | cmp ah,27 ;Esc |
||
63 | je button.exit |
||
64 | |||
65 | ;178 ;Up |
||
66 | ;177 ;Down |
||
67 | cmp ah,176 ;Left |
||
68 | jne @f |
||
69 | fld dword[angle_z] |
||
70 | fadd dword[delt_size] |
||
71 | fstp dword[angle_z] |
||
72 | call draw_3d |
||
8062 | IgorA | 73 | call [kosglSwapBuffers] |
5159 | IgorA | 74 | @@: |
75 | cmp ah,179 ;Right |
||
76 | jne @f |
||
77 | fld dword[angle_z] |
||
78 | fsub dword[delt_size] |
||
79 | fstp dword[angle_z] |
||
80 | call draw_3d |
||
8062 | IgorA | 81 | call [kosglSwapBuffers] |
5159 | IgorA | 82 | @@: |
83 | |||
84 | jmp still |
||
85 | |||
86 | align 4 |
||
87 | button: |
||
8062 | IgorA | 88 | mcall SF_GET_BUTTON |
5159 | IgorA | 89 | cmp ah,1 |
90 | jne still |
||
91 | .exit: |
||
8062 | IgorA | 92 | mcall SF_TERMINATE_PROCESS |
5159 | IgorA | 93 | |
94 | |||
95 | align 4 |
||
96 | caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0 |
||
97 | |||
98 | align 4 |
||
99 | draw_3d: |
||
100 | stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины |
||
101 | |||
8062 | IgorA | 102 | call [glPushMatrix] |
5159 | IgorA | 103 | stdcall [glRotatef], [angle_z],0.0,0.0,1.0 |
104 | |||
105 | stdcall [glColor3f],1.0, 0.0, 0.0 |
||
106 | stdcall [glBegin],GL_POINTS |
||
107 | stdcall [glVertex3f], 0.0, 0.5, 0.1 |
||
108 | stdcall [glVertex3f], 0.354, 0.354, 0.1 |
||
109 | stdcall [glVertex3f], 0.5, 0.0, 0.1 |
||
110 | stdcall [glVertex3f], 0.354, -0.354, 0.1 |
||
111 | stdcall [glVertex3f], 0.0, -0.5, 0.1 |
||
112 | stdcall [glVertex3f], -0.354,-0.354, 0.1 |
||
113 | stdcall [glVertex3f], -0.5, 0.0, 0.1 |
||
114 | stdcall [glVertex3f], -0.354, 0.354, 0.1 |
||
8062 | IgorA | 115 | call [glEnd] |
5159 | IgorA | 116 | |
117 | stdcall [glBegin],GL_LINES |
||
118 | stdcall [glVertex3f], 0, 0.7, 0.3 |
||
119 | stdcall [glVertex3f], 0.495, 0.495, 0.7 |
||
120 | stdcall [glVertex3f], 0.7, 0.0, 0.3 |
||
121 | stdcall [glColor3f],1.0, 1.0, 0.0 |
||
122 | stdcall [glVertex3f], 0.495, -0.495, 0.7 |
||
123 | stdcall [glVertex3f], 0.0, -0.7, 0.3 |
||
124 | stdcall [glVertex3f], -0.495,-0.495, 0.7 |
||
125 | stdcall [glVertex3f], -0.7, 0.0, 0.3 |
||
126 | stdcall [glColor3f],1.0, 0.0, 0.0 |
||
127 | stdcall [glVertex3f], -0.495, 0.495, 0.7 |
||
8062 | IgorA | 128 | call [glEnd] |
5159 | IgorA | 129 | |
8062 | IgorA | 130 | call [glPopMatrix] |
5159 | IgorA | 131 | ret |
132 | |||
133 | angle_z dd 0.0 |
||
134 | delt_size dd 3.0 |
||
135 | |||
136 | ;-------------------------------------------------- |
||
137 | align 4 |
||
138 | import_lib_tinygl: |
||
139 | |||
140 | macro E_LIB n |
||
141 | { |
||
142 | n dd sz_#n |
||
143 | } |
||
144 | include '../export.inc' |
||
145 | dd 0,0 |
||
146 | macro E_LIB n |
||
147 | { |
||
148 | sz_#n db `n,0 |
||
149 | } |
||
150 | include '../export.inc' |
||
151 | |||
152 | ;-------------------------------------------------- |
||
153 | system_path db '/sys/lib/' |
||
154 | name_tgl db 'tinygl.obj',0 |
||
8062 | IgorA | 155 | |
5159 | IgorA | 156 | head_f_i: |
8062 | IgorA | 157 | head_f_l db '"System error',0 |
158 | err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
||
159 | err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
||
5159 | IgorA | 160 | ;-------------------------------------------------- |
161 | |||
8062 | IgorA | 162 | align 16 |
5159 | IgorA | 163 | i_end: |
8062 | IgorA | 164 | ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
165 | ;sizeof.TinyGLContext = 28 |
||
5159 | IgorA | 166 | rb 1024 |
167 | stacktop: |
||
168 | cur_dir_path: |
||
169 | rb 4096 |
||
170 | library_path: |
||
171 | rb 4096 |
||
8062 | IgorA | 172 | mem:-]> |