Subversion Repositories Kolibri OS

Rev

Rev 5153 | Rev 6108 | 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 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
5256 IgorA 185
	jl .els_0
186
	cmp ebx,GL_LIGHT0+MAX_LIGHTS
187
	jge .els_0 ;if (GL_LIGHT0 <= ebx < GL_LIGHT0+MAX_LIGHTS)
188
		sub ebx,GL_LIGHT0
189
		stdcall gl_enable_disable_light, eax,ebx,ecx
190
		jmp .end_f
191
	.els_0:
192
;//fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code);
5153 IgorA 193
	.end_f:
194
	ret
195
endp
196
197
 
198
proc glopShadeModel uses eax ebx, context:dword,p:dword
199
	mov eax,[context]
200
	mov ebx,[p]
201
	mov ebx,[ebx+4]
202
	mov [eax+offs_cont_current_shade_model],ebx
203
	ret
204
endp
205
206
 
207
proc glopCullFace uses eax ebx, context:dword,p:dword
208
	mov eax,[context]
209
	mov ebx,[p]
210
	mov ebx,[ebx+4]
211
	mov [eax+offs_cont_current_cull_face],ebx
212
	ret
213
endp
214
215
 
216
proc glopFrontFace uses eax ebx, context:dword,p:dword
217
	mov eax,[context]
218
	mov ebx,[p]
219
	mov ebx,[ebx+4]
220
	mov [eax+offs_cont_current_front_face],ebx
221
	ret
222
endp
223
224
 
225
proc glopPolygonMode uses eax ebx, context:dword,p:dword
226
	mov eax,[context]
227
	mov ebx,[p]
228
229
 
230
	jne @f
231
		mov ebx,[ebx+8]
232
		mov [eax+offs_cont_polygon_mode_back],ebx
233
		jmp .end_f
234
	@@:
235
	cmp dword[ebx+4],GL_FRONT
236
	jne @f
237
		mov ebx,[ebx+8]
238
		mov [eax+offs_cont_polygon_mode_front],ebx
239
		jmp .end_f
240
	@@:
241
	cmp dword[ebx+4],GL_FRONT_AND_BACK
242
	jne @f
243
		mov ebx,[ebx+8]
244
		mov [eax+offs_cont_polygon_mode_front],ebx
245
		mov [eax+offs_cont_polygon_mode_back],ebx
246
		jmp .end_f
247
	@@:
248
;    assert(0);
249
	.end_f:
250
	ret
251
endp
252
253
 
254
proc glopHint, context:dword,p:dword
255
if 0
256
;  int target=p[1].i;
257
;  int mode=p[2].i;
258
259
 
260
end if
261
	ret
262
endp
263
264
 
265
proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword
266
	mov eax,[context]
267
	mov ebx,[p]
268
	mov ecx,[ebx+4]
269
	mov [eax+offs_cont_offset_factor],ecx
270
	mov ecx,[ebx+8]
271
	mov [eax+offs_cont_offset_units],ecx
272
	ret
273
endp
274