Subversion Repositories Kolibri OS

Rev

Rev 5256 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5153 IgorA 1
 
2
proc glopViewport uses eax ebx ecx edx, context:dword, p:dword
3
locals
4
	xsize dd ? ;int
5
	ysize dd ? ;int
6
	xmin dd ? ;int
7
	ymin dd ? ;int
8
	xsize_req dd ? ;int
9
	ysize_req dd ? ;int
10
endl
11
	mov edx,[context]
12
	mov ebx,[p]
13
14
 
15
	mov [xmin],ecx
16
	mov ecx,[ebx+8]
17
	mov [ymin],ecx
18
	mov ecx,[ebx+12]
19
	mov [xsize],ecx
20
	mov ecx,[ebx+16]
21
	mov [ysize],ecx
22
23
 
24
25
 
26
	jne @f
27
	mov ecx,[xmin]
28
	cmp dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx
29
	jne @f
30
	mov ecx,[ymin]
31
	cmp dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx
32
	jne @f
33
	mov ecx,[xsize]
34
	cmp dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx
35
	jne @f
36
		jmp .end_f
37
	@@:
38
39
 
40
	add ecx,[xsize]
41
	mov [xsize_req],ecx ;xsize_req = xmin + xsize
42
	mov ecx,[ymin]
43
	add ecx,[ysize]
44
	mov [ysize_req],ecx ;ysize_req = ymin + ysize
45
46
 
47
	je @f
48
		mov eax,ebp
49
		sub eax,4
50
		push eax
51
		sub eax,4
52
		push eax
53
		stdcall dword[edx+offs_cont_gl_resize_viewport], edx ;gl_resize_viewport(context,&xsize_req,&ysize_req)
54
		cmp eax,0
55
		je @f
56
			stdcall dbg_print,f_vp,err_4
57
	@@:
58
59
 
60
	sub ecx,[xmin]
61
	mov [xsize],ecx
62
	mov ecx,[ysize_req]
63
	sub ecx,[ymin]
64
	mov [ysize],ecx
65
	cmp ecx,0
66
	jg @f
67
	cmp dword[xsize],0
68
	jg @f
69
		stdcall dbg_print,f_vp,err_5
70
	@@:
71
if DEBUG ;glopViewport
72
push edi
73
	mov ecx,80
74
	mov eax,[xmin]
75
	lea edi,[buf_param]
76
	stdcall convert_int_to_str,ecx
77
	stdcall str_n_cat,edi,txt_zp_sp,2
78
	stdcall str_len,edi
79
	add edi,eax
80
	sub ecx,eax
81
82
 
83
	stdcall convert_int_to_str,ecx
84
	stdcall str_n_cat,edi,txt_zp_sp,2
85
	stdcall str_len,edi
86
	add edi,eax
87
	sub ecx,eax
88
89
 
90
	stdcall convert_int_to_str,ecx
91
	stdcall str_n_cat,edi,txt_zp_sp,2
92
	stdcall str_len,edi
93
	add edi,eax
94
	sub ecx,eax
95
96
 
97
	stdcall convert_int_to_str,ecx
98
99
 
100
	stdcall dbg_print,f_vp,buf_param
101
pop edi
102
end if
103
	mov ecx,[xmin]
104
	mov dword[edx+offs_cont_viewport+offs_vpor_xmin],ecx
105
	mov ecx,[ymin]
106
	mov dword[edx+offs_cont_viewport+offs_vpor_ymin],ecx
107
	mov ecx,[xsize]
108
	mov dword[edx+offs_cont_viewport+offs_vpor_xsize],ecx
109
	mov ecx,[ysize]
110
	mov dword[edx+offs_cont_viewport+offs_vpor_ysize],ecx
111
112
 
113
	.end_f:
114
	ret
115
endp
116
117
 
118
proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword
119
	mov eax,[context]
120
	mov ebx,[p]
121
	mov ecx,[ebx+8]
122
	mov ebx,[ebx+4]
123
124
 
125
	jne @f
126
		mov [eax+offs_cont_cull_face_enabled],ecx
127
		jmp .end_f
128
	@@:
129
	cmp ebx,GL_LIGHTING
130
	jne @f
131
		mov [eax+offs_cont_lighting_enabled],ecx
132
		jmp .end_f
133
	@@:
134
	cmp ebx,GL_COLOR_MATERIAL
135
	jne @f
136
		mov [eax+offs_cont_color_material_enabled],ecx
137
		jmp .end_f
138
	@@:
139
	cmp ebx,GL_TEXTURE_2D
140
	jne @f
141
		mov [eax+offs_cont_texture_2d_enabled],ecx
142
		jmp .end_f
143
	@@:
144
	cmp ebx,GL_NORMALIZE
145
	jne @f
146
		mov [eax+offs_cont_normalize_enabled],ecx
147
		jmp .end_f
148
	@@:
149
	cmp ebx,GL_DEPTH_TEST
150
	jne @f
151
		mov [eax+offs_cont_depth_test],ecx
152
		jmp .end_f
153
	@@:
154
	cmp ebx,GL_POLYGON_OFFSET_FILL
155
	jne .polygon_offset_fill
156
		cmp ecx,0
157
		je @f
158
			or dword[eax+offs_cont_offset_states],TGL_OFFSET_FILL
159
			jmp .end_f
160
		@@:
161
			and dword[eax+offs_cont_offset_states],not TGL_OFFSET_FILL
162
		jmp .end_f
163
	.polygon_offset_fill:
164
	cmp ebx,GL_POLYGON_OFFSET_POINT
165
	jne .polygon_offset_point
166
		cmp ecx,0
167
		je @f
168
			or dword[eax+offs_cont_offset_states],TGL_OFFSET_POINT
169
			jmp .end_f
170
		@@:
171
			and dword[eax+offs_cont_offset_states],not TGL_OFFSET_POINT
172
		jmp .end_f
173
	.polygon_offset_point:
174
	cmp ebx,GL_POLYGON_OFFSET_LINE
175
	jne .polygon_offset_line
176
		cmp ecx,0
177
		je @f
178
			or dword[eax+offs_cont_offset_states],TGL_OFFSET_LINE
179
			jmp .end_f
180
		@@:
181
			and dword[eax+offs_cont_offset_states],not TGL_OFFSET_LINE
182
		jmp .end_f
183
	.polygon_offset_line: ;default:
184
		cmp ebx,GL_LIGHT0
185
		jl .els_0
186
		cmp ebx,GL_LIGHT0+MAX_LIGHTS
187
		jge .els_0 ;if (GL_LIGHT0 <= ebx < GL_LIGHT0+MAX_LIGHTS)
188
			stdcall gl_enable_disable_light, eax,ebx-GL_LIGHT0,ecx
189
			jmp .end_f
190
		.els_0:
191
;//fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code);
192
	.end_f:
193
	ret
194
endp
195
196
 
197
proc glopShadeModel uses eax ebx, context:dword,p:dword
198
	mov eax,[context]
199
	mov ebx,[p]
200
	mov ebx,[ebx+4]
201
	mov [eax+offs_cont_current_shade_model],ebx
202
	ret
203
endp
204
205
 
206
proc glopCullFace uses eax ebx, context:dword,p:dword
207
	mov eax,[context]
208
	mov ebx,[p]
209
	mov ebx,[ebx+4]
210
	mov [eax+offs_cont_current_cull_face],ebx
211
	ret
212
endp
213
214
 
215
proc glopFrontFace uses eax ebx, context:dword,p:dword
216
	mov eax,[context]
217
	mov ebx,[p]
218
	mov ebx,[ebx+4]
219
	mov [eax+offs_cont_current_front_face],ebx
220
	ret
221
endp
222
223
 
224
proc glopPolygonMode uses eax ebx, context:dword,p:dword
225
	mov eax,[context]
226
	mov ebx,[p]
227
228
 
229
	jne @f
230
		mov ebx,[ebx+8]
231
		mov [eax+offs_cont_polygon_mode_back],ebx
232
		jmp .end_f
233
	@@:
234
	cmp dword[ebx+4],GL_FRONT
235
	jne @f
236
		mov ebx,[ebx+8]
237
		mov [eax+offs_cont_polygon_mode_front],ebx
238
		jmp .end_f
239
	@@:
240
	cmp dword[ebx+4],GL_FRONT_AND_BACK
241
	jne @f
242
		mov ebx,[ebx+8]
243
		mov [eax+offs_cont_polygon_mode_front],ebx
244
		mov [eax+offs_cont_polygon_mode_back],ebx
245
		jmp .end_f
246
	@@:
247
;    assert(0);
248
	.end_f:
249
	ret
250
endp
251
252
 
253
proc glopHint, context:dword,p:dword
254
if 0
255
;  int target=p[1].i;
256
;  int mode=p[2].i;
257
258
 
259
end if
260
	ret
261
endp
262
263
 
264
proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword
265
	mov eax,[context]
266
	mov ebx,[p]
267
	mov ecx,[ebx+4]
268
	mov [eax+offs_cont_offset_factor],ecx
269
	mov ecx,[ebx+8]
270
	mov [eax+offs_cont_offset_units],ecx
271
	ret
272
endp
273