Rev 5269 | Rev 7929 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5269 | Rev 6523 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | proc initSharedState uses eax ebx, context:dword |
2 | proc initSharedState uses eax ebx, context:dword |
3 | mov ebx,[context] |
3 | mov ebx,[context] |
4 | 4 | ||
Line 5... | Line 5... | ||
5 | stdcall gl_zalloc, 4*MAX_DISPLAY_LISTS |
5 | stdcall gl_zalloc, 4*MAX_DISPLAY_LISTS |
6 | mov [ebx+offs_cont_shared_state],eax ;...lists=gl_zalloc(...) |
6 | mov [ebx+GLContext.shared_state],eax ;...lists=gl_zalloc(...) |
7 | stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE |
7 | stdcall gl_zalloc, 4*TEXTURE_HASH_TABLE_SIZE |
8 | mov [ebx+offs_cont_shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) |
8 | mov [ebx+GLContext.shared_state+4],eax ;...texture_hash_table=gl_zalloc(...) |
Line 9... | Line 9... | ||
9 | 9 | ||
10 | stdcall alloc_texture, [context],0 |
10 | stdcall alloc_texture, [context],0 |
11 | ret |
11 | ret |
Line 17... | Line 17... | ||
17 | 17 | ||
Line 18... | Line 18... | ||
18 | ; for(i=0;i |
18 | ; for(i=0;i |
19 | ; /* TODO */ |
19 | ; /* TODO */ |
20 | ; } |
20 | ; } |
21 | stdcall gl_free, dword[ebx+offs_cont_shared_state] ;lists |
21 | stdcall gl_free, dword[ebx+GLContext.shared_state] ;lists |
22 | stdcall gl_free, dword[ebx+offs_cont_shared_state+4] ;texture_hash_table |
22 | stdcall gl_free, dword[ebx+GLContext.shared_state+4] ;texture_hash_table |
23 | ret |
23 | ret |
24 | endp |
24 | endp |
Line 25... | Line 25... | ||
25 | 25 | ||
26 | align 4 |
26 | align 4 |
27 | proc glInit uses eax ebx ecx edx, zbuffer1:dword |
27 | proc glInit uses eax ebx ecx edx, zbuffer1:dword |
28 | stdcall gl_zalloc,sizeof.GLContext |
28 | stdcall gl_zalloc,sizeof.GLContext |
29 | mov dword[gl_ctx],eax |
29 | mov dword[gl_ctx],eax |
Line 30... | Line 30... | ||
30 | mov edx,eax |
30 | mov edx,eax |
31 | 31 | ||
Line 32... | Line 32... | ||
32 | mov ecx,[zbuffer1] |
32 | mov ecx,[zbuffer1] |
33 | mov dword[edx+offs_cont_zb],ecx |
33 | mov dword[edx+GLContext.zb],ecx |
34 | 34 | ||
35 | ; allocate GLVertex array |
35 | ; allocate GLVertex array |
Line 36... | Line 36... | ||
36 | mov dword[edx+offs_cont_vertex_max],POLYGON_MAX_VERTEX |
36 | mov dword[edx+GLContext.vertex_max],POLYGON_MAX_VERTEX |
37 | stdcall gl_malloc, POLYGON_MAX_VERTEX*sizeof.GLVertex |
37 | stdcall gl_malloc, POLYGON_MAX_VERTEX*sizeof.GLVertex |
38 | mov dword[edx+offs_cont_vertex],eax |
38 | mov dword[edx+GLContext.vertex],eax |
39 | 39 | ||
40 | ; viewport |
40 | ; viewport |
41 | xor eax,eax |
41 | xor eax,eax |
42 | mov dword[edx+offs_cont_viewport+offs_vpor_xmin],eax |
42 | mov dword[edx+GLContext.viewport+offs_vpor_xmin],eax |
43 | mov dword[edx+offs_cont_viewport+offs_vpor_ymin],eax |
43 | mov dword[edx+GLContext.viewport+offs_vpor_ymin],eax |
44 | mov eax,[ecx+offs_zbuf_xsize] |
44 | mov eax,[ecx+offs_zbuf_xsize] |
Line 45... | Line 45... | ||
45 | mov dword[edx+offs_cont_viewport+offs_vpor_xsize],eax |
45 | mov dword[edx+GLContext.viewport+offs_vpor_xsize],eax |
46 | mov eax,[ecx+offs_zbuf_ysize] |
46 | mov eax,[ecx+offs_zbuf_ysize] |
Line 47... | Line 47... | ||
47 | mov dword[edx+offs_cont_viewport+offs_vpor_ysize],eax |
47 | mov dword[edx+GLContext.viewport+offs_vpor_ysize],eax |
48 | mov dword[edx+offs_cont_viewport+offs_vpor_updated],1 |
48 | mov dword[edx+GLContext.viewport+offs_vpor_updated],1 |
49 | 49 | ||
50 | ; shared state |
50 | ; shared state |
Line 51... | Line 51... | ||
51 | stdcall initSharedState,edx |
51 | stdcall initSharedState,edx |
Line 52... | Line 52... | ||
52 | 52 | ||
53 | ; lists |
53 | ; lists |
54 | mov dword[edx+offs_cont_exec_flag],1 |
54 | mov dword[edx+GLContext.exec_flag],1 |
55 | mov dword[edx+offs_cont_compile_flag],0 |
55 | mov dword[edx+GLContext.compile_flag],0 |
56 | mov dword[edx+offs_cont_print_flag],0 |
56 | mov dword[edx+GLContext.print_flag],0 |
57 | 57 | ||
58 | mov dword[edx+offs_cont_in_begin],0 |
58 | mov dword[edx+GLContext.in_begin],0 |
59 | 59 | ||
60 | ; lights |
60 | ; lights |
Line 77... | Line 77... | ||
77 | dec ecx |
77 | dec ecx |
78 | cmp ecx,0 |
78 | cmp ecx,0 |
79 | jg .cycle_0 |
79 | jg .cycle_0 |
80 | 80 | ||
Line 81... | Line 81... | ||
81 | mov dword[edx+offs_cont_first_light],0 ;NULL |
81 | mov dword[edx+GLContext.first_light],0 ;NULL |
82 | gl_V4_New edx+offs_cont_ambient_light_model, 0.2,0.2,0.2,1.0 |
82 | gl_V4_New edx+GLContext.ambient_light_model, 0.2,0.2,0.2,1.0 |
83 | mov dword[edx+offs_cont_local_light_model],0 |
83 | mov dword[edx+GLContext.local_light_model],0 |
84 | mov dword[edx+offs_cont_lighting_enabled],0 |
84 | mov dword[edx+GLContext.lighting_enabled],0 |
85 | mov dword[edx+offs_cont_light_model_two_side],0 |
85 | mov dword[edx+GLContext.light_model_two_side],0 |
Line 86... | Line 86... | ||
86 | 86 | ||
87 | ; default materials |
87 | ; default materials |
88 | mov ecx,2 ;for(i=0;i<2;i++) |
88 | mov ecx,2 ;for(i=0;i<2;i++) |
89 | mov eax,edx |
89 | mov eax,edx |
90 | add eax,offs_cont_materials |
90 | add eax,GLContext.materials |
91 | @@: |
91 | @@: |
92 | gl_V4_New eax+offs_mate_emission, 0.0,0.0,0.0,1.0 |
92 | gl_V4_New eax+offs_mate_emission, 0.0,0.0,0.0,1.0 |
93 | gl_V4_New eax+offs_mate_ambient, 0.2,0.2,0.2,1.0 |
93 | gl_V4_New eax+offs_mate_ambient, 0.2,0.2,0.2,1.0 |
94 | gl_V4_New eax+offs_mate_diffuse, 0.8,0.8,0.8,1.0 |
94 | gl_V4_New eax+offs_mate_diffuse, 0.8,0.8,0.8,1.0 |
95 | gl_V4_New eax+offs_mate_specular, 0.0,0.0,0.0,1.0 |
95 | gl_V4_New eax+offs_mate_specular, 0.0,0.0,0.0,1.0 |
96 | mov dword[eax+offs_mate_shininess], 0.0 |
96 | mov dword[eax+offs_mate_shininess], 0.0 |
97 | add eax,sizeof.GLMaterial |
97 | add eax,sizeof.GLMaterial |
Line 98... | Line 98... | ||
98 | loop @b |
98 | loop @b |
99 | 99 | ||
100 | mov dword[edx+offs_cont_current_color_material_mode],GL_FRONT_AND_BACK |
100 | mov dword[edx+GLContext.current_color_material_mode],GL_FRONT_AND_BACK |
Line 101... | Line 101... | ||
101 | mov dword[edx+offs_cont_current_color_material_type],GL_AMBIENT_AND_DIFFUSE |
101 | mov dword[edx+GLContext.current_color_material_type],GL_AMBIENT_AND_DIFFUSE |
102 | mov dword[edx+offs_cont_color_material_enabled],0 |
102 | mov dword[edx+GLContext.color_material_enabled],0 |
Line 103... | Line 103... | ||
103 | 103 | ||
104 | ; textures |
104 | ; textures |
105 | stdcall glInitTextures,edx |
105 | stdcall glInitTextures,edx |
Line 106... | Line 106... | ||
106 | 106 | ||
Line 107... | Line 107... | ||
107 | ; default state |
107 | ; default state |
Line 108... | Line 108... | ||
108 | gl_V4_New edx+offs_cont_current_color, 1.0,1.0,1.0,1.0 |
108 | gl_V4_New edx+GLContext.current_color, 1.0,1.0,1.0,1.0 |
Line 109... | Line 109... | ||
109 | gl_V3_New edx+offs_cont_longcurrent_color, 65535,65535,65535 |
109 | gl_V3_New edx+GLContext.longcurrent_color, 65535,65535,65535 |
110 | 110 | ||
Line 111... | Line 111... | ||
111 | gl_V4_New edx+offs_cont_current_normal, 1.0,0.0,0.0,0.0 |
111 | gl_V4_New edx+GLContext.current_normal, 1.0,0.0,0.0,0.0 |
112 | 112 | ||
113 | mov dword[edx+offs_cont_current_edge_flag],1 |
113 | mov dword[edx+GLContext.current_edge_flag],1 |
114 | 114 | ||
Line 115... | Line 115... | ||
115 | gl_V4_New edx+offs_cont_current_tex_coord, 0.0,0.0,0.0,1.0 |
115 | gl_V4_New edx+GLContext.current_tex_coord, 0.0,0.0,0.0,1.0 |
116 | 116 | ||
117 | mov dword[edx+offs_cont_polygon_mode_front],GL_FILL |
117 | mov dword[edx+GLContext.polygon_mode_front],GL_FILL |
Line 118... | Line 118... | ||
118 | mov dword[edx+offs_cont_polygon_mode_back],GL_FILL |
118 | mov dword[edx+GLContext.polygon_mode_back],GL_FILL |
119 | 119 | ||
120 | mov dword[edx+offs_cont_current_front_face],0 ;0 = GL_CCW 1 = GL_CW |
120 | mov dword[edx+GLContext.current_front_face],0 ;0 = GL_CCW 1 = GL_CW |
121 | mov dword[edx+offs_cont_current_cull_face],GL_BACK |
121 | mov dword[edx+GLContext.current_cull_face],GL_BACK |
Line 122... | Line 122... | ||
122 | mov dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
122 | mov dword[edx+GLContext.current_shade_model],GL_SMOOTH |
123 | mov dword[edx+offs_cont_cull_face_enabled],0 |
123 | mov dword[edx+GLContext.cull_face_enabled],0 |
Line 124... | Line 124... | ||
124 | 124 | ||
125 | ; clear |
125 | ; clear |
Line 126... | Line 126... | ||
126 | gl_V4_New edx+offs_cont_clear_color, 0.0,0.0,0.0,0.0 |
126 | gl_V4_New edx+GLContext.clear_color, 0.0,0.0,0.0,0.0 |
127 | mov dword[edx+offs_cont_clear_depth],0 |
127 | mov dword[edx+GLContext.clear_depth],0 |
128 | 128 | ||
129 | ; selection |
129 | ; selection |
130 | mov dword[edx+offs_cont_render_mode],GL_RENDER |
130 | mov dword[edx+GLContext.render_mode],GL_RENDER |
131 | mov dword[edx+offs_cont_select_buffer],0 ;NULL |
131 | mov dword[edx+GLContext.select_buffer],0 ;NULL |
132 | mov dword[edx+offs_cont_name_stack_size],0 |
132 | mov dword[edx+GLContext.name_stack_size],0 |
133 | 133 | ||
134 | ; matrix |
134 | ; matrix |
135 | mov dword[edx+offs_cont_matrix_mode],0 |
135 | mov dword[edx+GLContext.matrix_mode],0 |
Line 136... | Line 136... | ||
136 | 136 | ||
137 | gl_V3_New edx+offs_cont_matrix_stack_depth_max,\ |
137 | gl_V3_New edx+GLContext.matrix_stack_depth_max,\ |
138 | MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH |
138 | MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH |
139 | 139 | ||
140 | mov ecx,3 ;for(i=0;i<3;i++) |
140 | mov ecx,3 ;for(i=0;i<3;i++) |
141 | mov ebx,edx |
141 | mov ebx,edx |
Line 142... | Line 142... | ||
142 | @@: |
142 | @@: |
Line 143... | Line 143... | ||
143 | mov edi,[ebx+offs_cont_matrix_stack_depth_max] |
143 | mov edi,[ebx+GLContext.matrix_stack_depth_max] |
144 | shl edi,6 ;вместо imul edi,sizeof(M4) |
144 | shl edi,6 ;вместо imul edi,sizeof(M4) |
Line 145... | Line 145... | ||
145 | stdcall gl_zalloc,edi |
145 | stdcall gl_zalloc,edi |
146 | mov [ebx+offs_cont_matrix_stack],eax |
146 | mov [ebx+GLContext.matrix_stack],eax |
Line 147... | Line 147... | ||
147 | mov [ebx+offs_cont_matrix_stack_ptr],eax |
147 | mov [ebx+GLContext.matrix_stack_ptr],eax |
148 | add ebx,4 |
148 | add ebx,4 |
Line 149... | Line 149... | ||
149 | loop @b |
149 | loop @b |
150 | 150 | ||
151 | stdcall glMatrixMode,GL_PROJECTION |
151 | stdcall glMatrixMode,GL_PROJECTION |
152 | call glLoadIdentity |
152 | call glLoadIdentity |
Line 153... | Line 153... | ||
153 | stdcall glMatrixMode,GL_TEXTURE |
153 | stdcall glMatrixMode,GL_TEXTURE |
154 | call glLoadIdentity |
154 | call glLoadIdentity |
Line 155... | Line 155... | ||
155 | stdcall glMatrixMode,GL_MODELVIEW |
155 | stdcall glMatrixMode,GL_MODELVIEW |
156 | call glLoadIdentity |
156 | call glLoadIdentity |
Line 157... | Line 157... | ||
157 | 157 |