Subversion Repositories Kolibri OS

Rev

Rev 5171 | Rev 6523 | 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
	xor eax,eax
5269 IgorA 42
	mov dword[edx+offs_cont_viewport+offs_vpor_xmin],eax
43
	mov dword[edx+offs_cont_viewport+offs_vpor_ymin],eax
44
	mov eax,[ecx+offs_zbuf_xsize]
5153 IgorA 45
	mov dword[edx+offs_cont_viewport+offs_vpor_xsize],eax
5269 IgorA 46
	mov eax,[ecx+offs_zbuf_ysize]
5153 IgorA 47
	mov dword[edx+offs_cont_viewport+offs_vpor_ysize],eax
5269 IgorA 48
	mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
5153 IgorA 49
50
 
51
	stdcall initSharedState,edx
52
53
 
54
	mov dword[edx+offs_cont_exec_flag],1
55
	mov dword[edx+offs_cont_compile_flag],0
56
	mov dword[edx+offs_cont_print_flag],0
57
58
 
59
60
 
61
	mov ecx,MAX_LIGHTS
62
	mov eax,edx
63
	add eax,offs_cont_lights
64
	.cycle_0:
65
		gl_V4_New eax+offs_ligh_ambient, 0.0,0.0,0.0,1.0
66
		gl_V4_New eax+offs_ligh_diffuse, 1.0,1.0,1.0,1.0
67
		gl_V4_New eax+offs_ligh_specular, 1.0,1.0,1.0,1.0
68
		gl_V4_New eax+offs_ligh_position, 0.0,0.0,1.0,0.0
69
		gl_V3_New eax+offs_ligh_norm_position, 0.0,0.0,1.0
70
		gl_V3_New eax+offs_ligh_spot_direction, 0.0,0.0,-1.0
71
		gl_V3_New eax+offs_ligh_norm_spot_direction, 0.0,0.0,-1.0
72
		mov dword[eax+offs_ligh_spot_exponent],0.0
73
		mov dword[eax+offs_ligh_spot_cutoff],180.0
74
		gl_V3_New eax+offs_ligh_attenuation, 1.0,0.0,0.0
5269 IgorA 75
		mov dword[eax+offs_ligh_enabled],0
5153 IgorA 76
		add eax,sizeof.GLLight
77
		dec ecx
78
		cmp ecx,0
79
	jg .cycle_0
80
81
 
82
	gl_V4_New edx+offs_cont_ambient_light_model, 0.2,0.2,0.2,1.0
83
	mov dword[edx+offs_cont_local_light_model],0
84
	mov dword[edx+offs_cont_lighting_enabled],0
85
	mov dword[edx+offs_cont_light_model_two_side],0
86
87
 
88
	mov ecx,2 ;for(i=0;i<2;i++)
89
	mov eax,edx
90
	add eax,offs_cont_materials
91
	@@:
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
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
96
		mov dword[eax+offs_mate_shininess], 0.0
97
		add eax,sizeof.GLMaterial
98
	loop @b
99
100
 
101
	mov dword[edx+offs_cont_current_color_material_type],GL_AMBIENT_AND_DIFFUSE
102
	mov dword[edx+offs_cont_color_material_enabled],0
103
104
 
105
	stdcall glInitTextures,edx
106
107
 
108
	gl_V4_New edx+offs_cont_current_color, 1.0,1.0,1.0,1.0
5269 IgorA 109
	gl_V3_New edx+offs_cont_longcurrent_color, 65535,65535,65535
110
5153 IgorA 111
 
5269 IgorA 112
5153 IgorA 113
 
114
115
 
5269 IgorA 116
5153 IgorA 117
 
118
	mov dword[edx+offs_cont_polygon_mode_back],GL_FILL
119
120
 
121
	mov dword[edx+offs_cont_current_cull_face],GL_BACK
122
	mov dword[edx+offs_cont_current_shade_model],GL_SMOOTH
123
	mov dword[edx+offs_cont_cull_face_enabled],0
124
125
 
126
	gl_V4_New edx+offs_cont_clear_color, 0.0,0.0,0.0,0.0
5269 IgorA 127
	mov dword[edx+offs_cont_clear_depth],0
5153 IgorA 128
129
 
130
	mov dword[edx+offs_cont_render_mode],GL_RENDER
131
	mov dword[edx+offs_cont_select_buffer],0 ;NULL
132
	mov dword[edx+offs_cont_name_stack_size],0
133
134
 
135
	mov dword[edx+offs_cont_matrix_mode],0
136
137
 
5269 IgorA 138
		MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH
139
5153 IgorA 140
 
141
	mov ebx,edx
142
	@@:
143
		mov edi,[ebx+offs_cont_matrix_stack_depth_max]
144
		shl edi,6 ;вместо imul edi,sizeof(M4)
145
		stdcall gl_zalloc,edi
146
		mov [ebx+offs_cont_matrix_stack],eax
147
		mov [ebx+offs_cont_matrix_stack_ptr],eax
148
		add ebx,4
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
 
159
160
 
161
	mov dword[edx+offs_cont_client_states],0
162
163
 
164
	mov dword[edx+offs_cont_offset_states],0
165
166
 
167
	mov dword[edx+offs_cont_gl_resize_viewport],0 ;NULL
168
169
 
170
	mov dword[edx+offs_cont_specbuf_first],0 ;NULL
171
	mov dword[edx+offs_cont_specbuf_used_counter],0
172
	mov dword[edx+offs_cont_specbuf_num_buffers],0
173
174
 
175
	mov dword[edx+offs_cont_depth_test],0
176
177
 
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
endp
187
>