Subversion Repositories Kolibri OS

Rev

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