Rev 6523 | Rev 8063 | Go to most recent revision | Details | Compare with Previous | 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+GLContext.shared_state],eax ;...lists=gl_zalloc(...) |
||
6523 | IgorA | 7 | stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE |
5153 | IgorA | 8 | mov [ebx+GLContext.shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) |
6523 | IgorA | 9 | |
5153 | IgorA | 10 | |
11 | ret |
||
12 | endp |
||
13 | |||
14 | |||
15 | proc endSharedState uses eax ebx, context:dword |
||
16 | mov ebx,[context] |
||
17 | |||
18 | |||
19 | ; /* TODO */ |
||
20 | ; } |
||
21 | stdcall gl_free, dword[ebx+GLContext.shared_state] ;lists |
||
6523 | IgorA | 22 | stdcall gl_free, dword[ebx+GLContext.shared_state+4] ;texture_hash_table |
23 | ret |
||
5153 | IgorA | 24 | endp |
25 | |||
26 | |||
27 | proc glInit, zbuffer1:dword |
||
7929 | IgorA | 28 | pushad |
29 | stdcall gl_zalloc,sizeof.GLContext |
||
5153 | IgorA | 30 | mov dword[gl_ctx],eax |
31 | mov edx,eax |
||
32 | |||
33 | |||
34 | mov dword[edx+GLContext.zb],ecx |
||
6523 | IgorA | 35 | |
5153 | IgorA | 36 | |
37 | mov dword[edx+GLContext.vertex_max],POLYGON_MAX_VERTEX |
||
6523 | IgorA | 38 | stdcall gl_malloc, POLYGON_MAX_VERTEX*sizeof.GLVertex |
5153 | IgorA | 39 | mov dword[edx+GLContext.vertex],eax |
6523 | IgorA | 40 | |
5153 | IgorA | 41 | |
42 | xor eax,eax |
||
5269 | IgorA | 43 | mov dword[edx+GLContext.viewport+offs_vpor_xmin],eax |
6523 | IgorA | 44 | mov dword[edx+GLContext.viewport+offs_vpor_ymin],eax |
45 | mov eax,[ecx+offs_zbuf_xsize] |
||
5153 | IgorA | 46 | mov dword[edx+GLContext.viewport+offs_vpor_xsize],eax |
6523 | IgorA | 47 | mov eax,[ecx+offs_zbuf_ysize] |
5153 | IgorA | 48 | mov dword[edx+GLContext.viewport+offs_vpor_ysize],eax |
6523 | IgorA | 49 | mov dword[edx+GLContext.viewport+offs_vpor_updated],1 |
50 | |||
5153 | IgorA | 51 | |
52 | stdcall initSharedState,edx |
||
53 | |||
54 | |||
55 | mov dword[edx+GLContext.exec_flag],1 |
||
6523 | IgorA | 56 | mov dword[edx+GLContext.compile_flag],0 |
57 | mov dword[edx+GLContext.print_flag],0 |
||
58 | |||
5153 | IgorA | 59 | |
6523 | IgorA | 60 | |
5153 | IgorA | 61 | |
62 | mov ecx,MAX_LIGHTS |
||
63 | mov eax,edx |
||
64 | add eax,GLContext.lights |
||
6523 | IgorA | 65 | .cycle_0: |
5153 | IgorA | 66 | gl_V4_New eax+offs_ligh_ambient, 0.0,0.0,0.0,1.0 |
67 | gl_V4_New eax+offs_ligh_diffuse, 1.0,1.0,1.0,1.0 |
||
68 | gl_V4_New eax+offs_ligh_specular, 1.0,1.0,1.0,1.0 |
||
69 | gl_V4_New eax+offs_ligh_position, 0.0,0.0,1.0,0.0 |
||
70 | gl_V3_New eax+offs_ligh_norm_position, 0.0,0.0,1.0 |
||
71 | gl_V3_New eax+offs_ligh_spot_direction, 0.0,0.0,-1.0 |
||
72 | gl_V3_New eax+offs_ligh_norm_spot_direction, 0.0,0.0,-1.0 |
||
73 | mov dword[eax+offs_ligh_spot_exponent],0.0 |
||
74 | mov dword[eax+offs_ligh_spot_cutoff],180.0 |
||
75 | gl_V3_New eax+offs_ligh_attenuation, 1.0,0.0,0.0 |
||
5269 | IgorA | 76 | mov dword[eax+offs_ligh_enabled],0 |
5153 | IgorA | 77 | add eax,sizeof.GLLight |
78 | dec ecx |
||
79 | cmp ecx,0 |
||
80 | jg .cycle_0 |
||
81 | |||
82 | |||
6523 | IgorA | 83 | gl_V4_New edx+GLContext.ambient_light_model, 0.2,0.2,0.2,1.0 |
84 | mov dword[edx+GLContext.local_light_model],0 |
||
85 | mov dword[edx+GLContext.lighting_enabled],0 |
||
86 | mov dword[edx+GLContext.light_model_two_side],0 |
||
87 | |||
5153 | IgorA | 88 | |
89 | mov ecx,2 ;for(i=0;i<2;i++) |
||
90 | mov eax,edx |
||
91 | add eax,GLContext.materials |
||
6523 | IgorA | 92 | @@: |
5153 | IgorA | 93 | gl_V4_New eax+offs_mate_emission, 0.0,0.0,0.0,1.0 |
94 | gl_V4_New eax+offs_mate_ambient, 0.2,0.2,0.2,1.0 |
||
95 | gl_V4_New eax+offs_mate_diffuse, 0.8,0.8,0.8,1.0 |
||
96 | gl_V4_New eax+offs_mate_specular, 0.0,0.0,0.0,1.0 |
||
97 | mov dword[eax+offs_mate_shininess], 0.0 |
||
98 | add eax,sizeof.GLMaterial |
||
99 | loop @b |
||
100 | |||
101 | |||
6523 | IgorA | 102 | mov dword[edx+GLContext.current_color_material_type],GL_AMBIENT_AND_DIFFUSE |
103 | mov dword[edx+GLContext.color_material_enabled],0 |
||
104 | |||
5153 | IgorA | 105 | |
106 | stdcall glInitTextures,edx |
||
107 | |||
108 | |||
109 | gl_V4_New edx+GLContext.current_color, 1.0,1.0,1.0,1.0 |
||
6523 | IgorA | 110 | gl_V3_New edx+GLContext.longcurrent_color, 65535,65535,65535 |
111 | |||
5153 | IgorA | 112 | |
6523 | IgorA | 113 | |
5153 | IgorA | 114 | |
6523 | IgorA | 115 | |
5153 | IgorA | 116 | |
6523 | IgorA | 117 | |
5153 | IgorA | 118 | |
6523 | IgorA | 119 | mov dword[edx+GLContext.polygon_mode_back],GL_FILL |
120 | |||
5153 | IgorA | 121 | |
6523 | IgorA | 122 | mov dword[edx+GLContext.current_cull_face],GL_BACK |
123 | mov dword[edx+GLContext.current_shade_model],GL_SMOOTH |
||
124 | mov dword[edx+GLContext.cull_face_enabled],0 |
||
125 | |||
5153 | IgorA | 126 | |
127 | gl_V4_New edx+GLContext.clear_color, 0.0,0.0,0.0,0.0 |
||
6523 | IgorA | 128 | mov dword[edx+GLContext.clear_depth],0 |
129 | |||
5153 | IgorA | 130 | |
131 | mov dword[edx+GLContext.render_mode],GL_RENDER |
||
6523 | IgorA | 132 | mov dword[edx+GLContext.select_buffer],0 ;NULL |
133 | mov dword[edx+GLContext.name_stack_size],0 |
||
134 | |||
5153 | IgorA | 135 | |
136 | mov dword[edx+GLContext.matrix_mode],0 |
||
6523 | IgorA | 137 | |
5153 | IgorA | 138 | |
6523 | IgorA | 139 | MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH |
5269 | IgorA | 140 | |
5153 | IgorA | 141 | |
142 | mov ebx,edx |
||
143 | @@: |
||
144 | mov edi,[ebx+GLContext.matrix_stack_depth_max] |
||
6523 | IgorA | 145 | shl edi,6 ;вместо imul edi,sizeof(M4) |
5153 | IgorA | 146 | stdcall gl_zalloc,edi |
147 | mov [ebx+GLContext.matrix_stack],eax |
||
6523 | IgorA | 148 | mov [ebx+GLContext.matrix_stack_ptr],eax |
149 | add ebx,4 |
||
5153 | IgorA | 150 | loop @b |
151 | |||
152 | |||
153 | call glLoadIdentity |
||
154 | stdcall glMatrixMode,GL_TEXTURE |
||
155 | call glLoadIdentity |
||
156 | stdcall glMatrixMode,GL_MODELVIEW |
||
157 | call glLoadIdentity |
||
158 | |||
159 | |||
6523 | IgorA | 160 | |
5153 | IgorA | 161 | |
162 | mov dword[edx+GLContext.client_states],0 |
||
6523 | IgorA | 163 | |
5153 | IgorA | 164 | |
165 | mov dword[edx+GLContext.offset_states],0 |
||
6523 | IgorA | 166 | |
5153 | IgorA | 167 | |
168 | mov dword[edx+GLContext.gl_resize_viewport],0 ;NULL |
||
6523 | IgorA | 169 | |
5153 | IgorA | 170 | |
171 | mov dword[edx+GLContext.specbuf_first],0 ;NULL |
||
6523 | IgorA | 172 | mov dword[edx+GLContext.specbuf_used_counter],0 |
173 | mov dword[edx+GLContext.specbuf_num_buffers],0 |
||
174 | |||
5153 | IgorA | 175 | |
176 | mov dword[edx+GLContext.depth_test],0 |
||
6523 | IgorA | 177 | popad |
7929 | IgorA | 178 | ret |
5153 | IgorA | 179 | endp |
180 | |||
181 | |||
182 | proc glClose uses eax |
||
183 | call gl_get_context |
||
184 | stdcall endSharedState,eax |
||
185 | stdcall gl_free,eax |
||
186 | ret |
||
187 | endp3;i++) |
||
188 | >2;i++) |