Rev 5171 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5153 | IgorA | 1 | |
2 | proc initSharedState uses eax ebx, context:dword |
||
3 | mov ebx,[context] |
||
4 | |||
5 | |||
6 | mov [ebx+offs_cont_shared_state],eax ;...lists=gl_zalloc(...) |
||
7 | stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE |
||
8 | mov [ebx+offs_cont_shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) |
||
9 | |||
10 | |||
11 | ret |
||
12 | endp |
||
13 | |||
14 | |||
15 | proc endSharedState uses eax ebx, context:dword |
||
16 | mov ebx,[context] |
||
17 | mov ebx,[ebx+offs_cont_shared_state] |
||
18 | |||
19 | |||
20 | ; for(i=0;i |
||
21 | ; /* TODO */ |
||
22 | ; } |
||
23 | stdcall gl_free, dword[ebx] ;lists |
||
24 | stdcall gl_free, dword[ebx+4] ;texture_hash_table |
||
25 | ret |
||
26 | endp |
||
27 | |||
28 | |||
29 | proc glInit uses eax ebx ecx edx, zbuffer1:dword |
||
30 | ; int i; |
||
31 | |||
32 | |||
33 | mov dword[gl_ctx],eax |
||
34 | mov edx,eax |
||
35 | |||
36 | |||
37 | mov dword[edx+offs_cont_zb],ecx |
||
38 | |||
39 | |||
40 | mov dword[edx+offs_cont_vertex_max],POLYGON_MAX_VERTEX |
||
41 | stdcall gl_malloc, POLYGON_MAX_VERTEX*sizeof.GLVertex |
||
42 | mov dword[edx+offs_cont_vertex],eax |
||
43 | |||
44 | |||
45 | mov dword[edx+offs_cont_viewport+offs_vpor_xmin],0 |
||
46 | mov dword[edx+offs_cont_viewport+offs_vpor_ymin],0 |
||
47 | mov eax,[ecx+offs_zbuf_xsize] |
||
48 | mov dword[edx+offs_cont_viewport+offs_vpor_xsize], eax |
||
49 | mov eax,[ecx+offs_zbuf_ysize] |
||
50 | mov dword[edx+offs_cont_viewport+offs_vpor_ysize], eax |
||
51 | mov dword[edx+offs_cont_viewport+offs_vpor_updated],1 |
||
52 | |||
53 | |||
54 | stdcall initSharedState,edx |
||
55 | |||
56 | |||
57 | mov dword[edx+offs_cont_exec_flag],1 |
||
58 | mov dword[edx+offs_cont_compile_flag],0 |
||
59 | mov dword[edx+offs_cont_print_flag],0 |
||
60 | |||
61 | |||
62 | |||
63 | |||
64 | mov ecx,MAX_LIGHTS |
||
65 | mov eax,edx |
||
66 | add eax,offs_cont_lights |
||
67 | .cycle_0: |
||
68 | gl_V4_New eax+offs_ligh_ambient, 0.0,0.0,0.0,1.0 |
||
69 | gl_V4_New eax+offs_ligh_diffuse, 1.0,1.0,1.0,1.0 |
||
70 | gl_V4_New eax+offs_ligh_specular, 1.0,1.0,1.0,1.0 |
||
71 | gl_V4_New eax+offs_ligh_position, 0.0,0.0,1.0,0.0 |
||
72 | gl_V3_New eax+offs_ligh_norm_position, 0.0,0.0,1.0 |
||
73 | gl_V3_New eax+offs_ligh_spot_direction, 0.0,0.0,-1.0 |
||
74 | gl_V3_New eax+offs_ligh_norm_spot_direction, 0.0,0.0,-1.0 |
||
75 | mov dword[eax+offs_ligh_spot_exponent],0.0 |
||
76 | mov dword[eax+offs_ligh_spot_cutoff],180.0 |
||
77 | mov dword[eax+offs_ligh_attenuation],1.0 |
||
78 | mov dword[eax+offs_ligh_attenuation+4],0.0 |
||
79 | mov dword[eax+offs_ligh_attenuation+8],0.0 |
||
80 | mov dword[eax+offs_ligh_enabled],0 |
||
81 | add eax,sizeof.GLLight |
||
82 | dec ecx |
||
83 | cmp ecx,0 |
||
84 | jg .cycle_0 |
||
85 | |||
86 | |||
87 | gl_V4_New edx+offs_cont_ambient_light_model, 0.2,0.2,0.2,1.0 |
||
88 | mov dword[edx+offs_cont_local_light_model],0 |
||
89 | mov dword[edx+offs_cont_lighting_enabled],0 |
||
90 | mov dword[edx+offs_cont_light_model_two_side],0 |
||
91 | |||
92 | |||
93 | mov ecx,2 ;for(i=0;i<2;i++) |
||
94 | mov eax,edx |
||
95 | add eax,offs_cont_materials |
||
96 | @@: |
||
97 | gl_V4_New eax+offs_mate_emission, 0.0,0.0,0.0,1.0 |
||
98 | gl_V4_New eax+offs_mate_ambient, 0.2,0.2,0.2,1.0 |
||
99 | gl_V4_New eax+offs_mate_diffuse, 0.8,0.8,0.8,1.0 |
||
100 | gl_V4_New eax+offs_mate_specular, 0.0,0.0,0.0,1.0 |
||
101 | mov dword[eax+offs_mate_shininess], 0.0 |
||
102 | add eax,sizeof.GLMaterial |
||
103 | loop @b |
||
104 | |||
105 | |||
106 | mov dword[edx+offs_cont_current_color_material_type],GL_AMBIENT_AND_DIFFUSE |
||
107 | mov dword[edx+offs_cont_color_material_enabled],0 |
||
108 | |||
109 | |||
110 | stdcall glInitTextures,edx |
||
111 | |||
112 | |||
113 | mov dword[edx+offs_cont_current_color],1.0 |
||
114 | mov dword[edx+offs_cont_current_color+4],1.0 |
||
115 | mov dword[edx+offs_cont_current_color+8],1.0 |
||
116 | mov dword[edx+offs_cont_current_color+12],1.0 |
||
117 | mov dword[edx+offs_cont_longcurrent_color],65535 |
||
118 | mov dword[edx+offs_cont_longcurrent_color+4],65535 |
||
119 | mov dword[edx+offs_cont_longcurrent_color+8],65535 |
||
120 | |||
121 | |||
122 | mov dword[edx+offs_cont_current_normal+4],0.0 |
||
123 | mov dword[edx+offs_cont_current_normal+8],0.0 |
||
124 | mov dword[edx+offs_cont_current_normal+12],0.0 |
||
125 | |||
126 | |||
127 | |||
128 | |||
129 | mov dword[edx+offs_cont_current_tex_coord+4],0.0 |
||
130 | mov dword[edx+offs_cont_current_tex_coord+8],0.0 |
||
131 | mov dword[edx+offs_cont_current_tex_coord+12],1.0 |
||
132 | |||
133 | |||
134 | mov dword[edx+offs_cont_polygon_mode_back],GL_FILL |
||
135 | |||
136 | |||
137 | mov dword[edx+offs_cont_current_cull_face],GL_BACK |
||
138 | mov dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
||
139 | mov dword[edx+offs_cont_cull_face_enabled],0 |
||
140 | |||
141 | |||
142 | mov dword[edx+offs_cont_clear_color],0.0 |
||
143 | mov dword[edx+offs_cont_clear_color+4],0.0 |
||
144 | mov dword[edx+offs_cont_clear_color+8],0.0 |
||
145 | mov dword[edx+offs_cont_clear_color+12],0.0 |
||
146 | mov dword[edx+offs_cont_clear_depth],0 |
||
147 | |||
148 | |||
149 | mov dword[edx+offs_cont_render_mode],GL_RENDER |
||
150 | mov dword[edx+offs_cont_select_buffer],0 ;NULL |
||
151 | mov dword[edx+offs_cont_name_stack_size],0 |
||
152 | |||
153 | |||
154 | mov dword[edx+offs_cont_matrix_mode],0 |
||
155 | |||
156 | |||
157 | mov dword[edx+offs_cont_matrix_stack_depth_max+4],MAX_PROJECTION_STACK_DEPTH |
||
158 | mov dword[edx+offs_cont_matrix_stack_depth_max+8],MAX_TEXTURE_STACK_DEPTH |
||
159 | |||
160 | |||
161 | mov ebx,edx |
||
162 | @@: |
||
163 | mov edi,[ebx+offs_cont_matrix_stack_depth_max] |
||
164 | shl edi,6 ;вместо imul edi,sizeof(M4) |
||
165 | stdcall gl_zalloc,edi |
||
166 | mov [ebx+offs_cont_matrix_stack],eax |
||
167 | mov [ebx+offs_cont_matrix_stack_ptr],eax |
||
168 | add ebx,4 |
||
169 | loop @b |
||
170 | |||
171 | |||
172 | call glLoadIdentity |
||
173 | stdcall glMatrixMode,GL_TEXTURE |
||
174 | call glLoadIdentity |
||
175 | stdcall glMatrixMode,GL_MODELVIEW |
||
176 | call glLoadIdentity |
||
177 | |||
178 | |||
179 | |||
180 | |||
181 | mov dword[edx+offs_cont_client_states],0 |
||
182 | |||
183 | |||
184 | mov dword[edx+offs_cont_offset_states],0 |
||
185 | |||
186 | |||
187 | mov dword[edx+offs_cont_gl_resize_viewport],0 ;NULL |
||
188 | |||
189 | |||
190 | mov dword[edx+offs_cont_specbuf_first],0 ;NULL |
||
191 | mov dword[edx+offs_cont_specbuf_used_counter],0 |
||
192 | mov dword[edx+offs_cont_specbuf_num_buffers],0 |
||
193 | |||
194 | |||
195 | mov dword[edx+offs_cont_depth_test],0 |
||
196 | |||
197 | |||
198 | endp |
||
199 | |||
200 | |||
201 | proc glClose uses eax |
||
202 | call gl_get_context |
||
203 | stdcall endSharedState,eax |
||
204 | stdcall gl_free,eax |
||
205 | ret |
||
206 | endp3;i++) |
||
207 | >2;i++) |