Rev 8063 | 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+GLViewport.xmin],eax |
8069 | IgorA | 44 | mov dword[edx+GLContext.viewport+GLViewport.ymin],eax |
45 | mov eax,[ecx+ZBuffer.xsize] |
||
46 | mov dword[edx+GLContext.viewport+GLViewport.xsize],eax |
||
47 | mov eax,[ecx+ZBuffer.ysize] |
||
48 | mov dword[edx+GLContext.viewport+GLViewport.ysize],eax |
||
49 | mov dword[edx+GLContext.viewport+GLViewport.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+GLLight.ambient, 0.0,0.0,0.0,1.0 |
8063 | IgorA | 67 | gl_V4_New eax+GLLight.diffuse, 1.0,1.0,1.0,1.0 |
68 | gl_V4_New eax+GLLight.specular, 1.0,1.0,1.0,1.0 |
||
69 | gl_V4_New eax+GLLight.position, 0.0,0.0,1.0,0.0 |
||
70 | gl_V3_New eax+GLLight.norm_position, 0.0,0.0,1.0 |
||
71 | gl_V3_New eax+GLLight.spot_direction, 0.0,0.0,-1.0 |
||
72 | gl_V3_New eax+GLLight.norm_spot_direction, 0.0,0.0,-1.0 |
||
73 | mov dword[eax+GLLight.spot_exponent],0.0 |
||
74 | mov dword[eax+GLLight.spot_cutoff],180.0 |
||
75 | gl_V3_New eax+GLLight.attenuation, 1.0,0.0,0.0 |
||
76 | mov dword[eax+GLLight.enabled],0 |
||
77 | add eax,sizeof.GLLight |
||
5153 | IgorA | 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 | lea eax,[edx+GLContext.materials] |
||
8063 | IgorA | 91 | @@: |
5153 | IgorA | 92 | gl_V4_New eax+GLMaterial.emission, 0.0,0.0,0.0,1.0 |
8063 | IgorA | 93 | gl_V4_New eax+GLMaterial.ambient, 0.2,0.2,0.2,1.0 |
94 | gl_V4_New eax+GLMaterial.diffuse, 0.8,0.8,0.8,1.0 |
||
95 | gl_V4_New eax+GLMaterial.specular, 0.0,0.0,0.0,1.0 |
||
96 | mov dword[eax+GLMaterial.shininess], 0.0 |
||
97 | add eax,sizeof.GLMaterial |
||
5153 | IgorA | 98 | loop @b |
99 | |||
100 | |||
6523 | IgorA | 101 | mov dword[edx+GLContext.current_color_material_type],GL_AMBIENT_AND_DIFFUSE |
102 | mov dword[edx+GLContext.color_material_enabled],0 |
||
103 | |||
5153 | IgorA | 104 | |
105 | stdcall glInitTextures,edx |
||
106 | |||
107 | |||
108 | gl_V4_New edx+GLContext.current_color, 1.0,1.0,1.0,1.0 |
||
6523 | IgorA | 109 | gl_V3_New edx+GLContext.longcurrent_color, 65535,65535,65535 |
110 | |||
5153 | IgorA | 111 | |
6523 | IgorA | 112 | |
5153 | IgorA | 113 | |
6523 | IgorA | 114 | |
5153 | IgorA | 115 | |
6523 | IgorA | 116 | |
5153 | IgorA | 117 | |
6523 | IgorA | 118 | mov dword[edx+GLContext.polygon_mode_back],GL_FILL |
119 | |||
5153 | IgorA | 120 | |
6523 | IgorA | 121 | mov dword[edx+GLContext.current_cull_face],GL_BACK |
122 | mov dword[edx+GLContext.current_shade_model],GL_SMOOTH |
||
123 | mov dword[edx+GLContext.cull_face_enabled],0 |
||
124 | |||
5153 | IgorA | 125 | |
126 | gl_V4_New edx+GLContext.clear_color, 0.0,0.0,0.0,0.0 |
||
6523 | IgorA | 127 | mov dword[edx+GLContext.clear_depth],0 |
128 | |||
5153 | IgorA | 129 | |
130 | mov dword[edx+GLContext.render_mode],GL_RENDER |
||
6523 | IgorA | 131 | mov dword[edx+GLContext.select_buffer],0 ;NULL |
132 | mov dword[edx+GLContext.name_stack_size],0 |
||
133 | |||
5153 | IgorA | 134 | |
135 | mov dword[edx+GLContext.matrix_mode],0 |
||
6523 | IgorA | 136 | |
5153 | IgorA | 137 | |
6523 | IgorA | 138 | MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH |
5269 | IgorA | 139 | |
5153 | IgorA | 140 | |
141 | mov ebx,edx |
||
142 | @@: |
||
143 | mov edi,[ebx+GLContext.matrix_stack_depth_max] |
||
6523 | IgorA | 144 | shl edi,6 ;вместо imul edi,sizeof(M4) |
5153 | IgorA | 145 | stdcall gl_zalloc,edi |
146 | mov [ebx+GLContext.matrix_stack],eax |
||
6523 | IgorA | 147 | mov [ebx+GLContext.matrix_stack_ptr],eax |
148 | add ebx,4 |
||
5153 | IgorA | 149 | loop @b |
150 | |||
151 | |||
152 | call glLoadIdentity |
||
153 | stdcall glMatrixMode,GL_TEXTURE |
||
154 | call glLoadIdentity |
||
155 | stdcall glMatrixMode,GL_MODELVIEW |
||
156 | call glLoadIdentity |
||
157 | |||
158 | |||
6523 | IgorA | 159 | |
5153 | IgorA | 160 | |
161 | mov dword[edx+GLContext.client_states],0 |
||
6523 | IgorA | 162 | |
5153 | IgorA | 163 | |
164 | mov dword[edx+GLContext.offset_states],0 |
||
6523 | IgorA | 165 | |
5153 | IgorA | 166 | |
167 | mov dword[edx+GLContext.gl_resize_viewport],0 ;NULL |
||
6523 | IgorA | 168 | |
5153 | IgorA | 169 | |
170 | mov dword[edx+GLContext.specbuf_first],0 ;NULL |
||
6523 | IgorA | 171 | mov dword[edx+GLContext.specbuf_used_counter],0 |
172 | mov dword[edx+GLContext.specbuf_num_buffers],0 |
||
173 | |||
5153 | IgorA | 174 | |
175 | mov dword[edx+GLContext.depth_test],0 |
||
6523 | IgorA | 176 | popad |
7929 | IgorA | 177 | ret |
5153 | IgorA | 178 | endp |
179 | |||
180 | |||
181 | proc glClose uses eax |
||
182 | call gl_get_context |
||
183 | stdcall endSharedState,eax |
||
184 | stdcall gl_free,eax |
||
185 | ret |
||
186 | endp3;i++) |
||
187 | >2;i++) |