Subversion Repositories Kolibri OS

Rev

Rev 6523 | 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
 
8069 IgorA 26
	jne @f
5153 IgorA 27
	mov ecx,[xmin]
28
	cmp dword[edx+GLContext.viewport+GLViewport.xmin],ecx
8069 IgorA 29
	jne @f
5153 IgorA 30
	mov ecx,[ymin]
31
	cmp dword[edx+GLContext.viewport+GLViewport.ymin],ecx
8069 IgorA 32
	jne @f
5153 IgorA 33
	mov ecx,[xsize]
34
	cmp dword[edx+GLContext.viewport+GLViewport.xsize],ecx
8069 IgorA 35
	jne @f
5153 IgorA 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
 
6523 IgorA 47
	je @f
5153 IgorA 48
		mov eax,ebp
49
		sub eax,4
50
		push eax
51
		sub eax,4
52
		push eax
53
		stdcall dword[edx+GLContext.gl_resize_viewport], edx ;gl_resize_viewport(context,&xsize_req,&ysize_req)
6523 IgorA 54
		cmp eax,0
5153 IgorA 55
		je @f
56
			stdcall dbg_print,sz_glViewport,err_4
6108 IgorA 57
	@@:
5153 IgorA 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,sz_glViewport,err_5
6108 IgorA 70
	@@:
5153 IgorA 71
	mov ecx,[xmin]
72
	mov dword[edx+GLContext.viewport+GLViewport.xmin],ecx
8069 IgorA 73
	mov ecx,[ymin]
5153 IgorA 74
	mov dword[edx+GLContext.viewport+GLViewport.ymin],ecx
8069 IgorA 75
	mov ecx,[xsize]
5153 IgorA 76
	mov dword[edx+GLContext.viewport+GLViewport.xsize],ecx
8069 IgorA 77
	mov ecx,[ysize]
5153 IgorA 78
	mov dword[edx+GLContext.viewport+GLViewport.ysize],ecx
8069 IgorA 79
5153 IgorA 80
 
8069 IgorA 81
	.end_f:
5153 IgorA 82
	ret
83
endp
84
85
 
86
proc glopEnableDisable uses eax ebx ecx, context:dword, p:dword
87
	mov eax,[context]
88
	mov ebx,[p]
89
	mov ecx,[ebx+8]
90
	mov ebx,[ebx+4]
91
92
 
93
	jne @f
94
		mov [eax+GLContext.cull_face_enabled],ecx
6523 IgorA 95
		jmp .end_f
5153 IgorA 96
	@@:
97
	cmp ebx,GL_LIGHTING
98
	jne @f
99
		mov [eax+GLContext.lighting_enabled],ecx
6523 IgorA 100
		jmp .end_f
5153 IgorA 101
	@@:
102
	cmp ebx,GL_COLOR_MATERIAL
103
	jne @f
104
		mov [eax+GLContext.color_material_enabled],ecx
6523 IgorA 105
		jmp .end_f
5153 IgorA 106
	@@:
107
	cmp ebx,GL_TEXTURE_2D
108
	jne @f
109
		mov [eax+GLContext.texture_2d_enabled],ecx
6523 IgorA 110
		jmp .end_f
5153 IgorA 111
	@@:
112
	cmp ebx,GL_NORMALIZE
113
	jne @f
114
		mov [eax+GLContext.normalize_enabled],ecx
6523 IgorA 115
		jmp .end_f
5153 IgorA 116
	@@:
117
	cmp ebx,GL_DEPTH_TEST
118
	jne @f
119
		mov [eax+GLContext.depth_test],ecx
6523 IgorA 120
		jmp .end_f
5153 IgorA 121
	@@:
122
	cmp ebx,GL_POLYGON_OFFSET_FILL
123
	jne .polygon_offset_fill
124
		cmp ecx,0
125
		je @f
126
			or dword[eax+GLContext.offset_states],TGL_OFFSET_FILL
6523 IgorA 127
			jmp .end_f
5153 IgorA 128
		@@:
129
			and dword[eax+GLContext.offset_states],not TGL_OFFSET_FILL
6523 IgorA 130
		jmp .end_f
5153 IgorA 131
	.polygon_offset_fill:
132
	cmp ebx,GL_POLYGON_OFFSET_POINT
133
	jne .polygon_offset_point
134
		cmp ecx,0
135
		je @f
136
			or dword[eax+GLContext.offset_states],TGL_OFFSET_POINT
6523 IgorA 137
			jmp .end_f
5153 IgorA 138
		@@:
139
			and dword[eax+GLContext.offset_states],not TGL_OFFSET_POINT
6523 IgorA 140
		jmp .end_f
5153 IgorA 141
	.polygon_offset_point:
142
	cmp ebx,GL_POLYGON_OFFSET_LINE
143
	jne .polygon_offset_line
144
		cmp ecx,0
145
		je @f
146
			or dword[eax+GLContext.offset_states],TGL_OFFSET_LINE
6523 IgorA 147
			jmp .end_f
5153 IgorA 148
		@@:
149
			and dword[eax+GLContext.offset_states],not TGL_OFFSET_LINE
6523 IgorA 150
		jmp .end_f
5153 IgorA 151
	.polygon_offset_line: ;default:
152
	cmp ebx,GL_LIGHT0
5256 IgorA 153
	jl .els_0
154
	cmp ebx,GL_LIGHT0+MAX_LIGHTS
155
	jge .els_0 ;if (GL_LIGHT0 <= ebx < GL_LIGHT0+MAX_LIGHTS)
156
		sub ebx,GL_LIGHT0
157
		stdcall gl_enable_disable_light, eax,ebx,ecx
158
		jmp .end_f
159
	.els_0:
160
;fprintf(stderr,"glEnableDisable: 0x%X not supported.\n",code);
6523 IgorA 161
	.end_f:
5153 IgorA 162
	ret
163
endp
164
165
 
166
proc glopShadeModel uses eax ebx, context:dword,p:dword
167
	mov eax,[context]
168
	mov ebx,[p]
169
	mov ebx,[ebx+4]
170
	mov [eax+GLContext.current_shade_model],ebx
6523 IgorA 171
	ret
5153 IgorA 172
endp
173
174
 
175
proc glopCullFace uses eax ebx, context:dword,p:dword
176
	mov eax,[context]
177
	mov ebx,[p]
178
	mov ebx,[ebx+4]
179
	mov [eax+GLContext.current_cull_face],ebx
6523 IgorA 180
	ret
5153 IgorA 181
endp
182
183
 
184
proc glopFrontFace uses eax ebx, context:dword,p:dword
185
	mov eax,[context]
186
	mov ebx,[p]
187
	mov ebx,[ebx+4]
188
	mov [eax+GLContext.current_front_face],ebx
6523 IgorA 189
	ret
5153 IgorA 190
endp
191
192
 
193
proc glopPolygonMode uses eax ebx, context:dword,p:dword
194
	mov eax,[context]
195
	mov ebx,[p]
196
197
 
198
	jne @f
199
		mov ebx,[ebx+8]
200
		mov [eax+GLContext.polygon_mode_back],ebx
6523 IgorA 201
		jmp .end_f
5153 IgorA 202
	@@:
203
	cmp dword[ebx+4],GL_FRONT
204
	jne @f
205
		mov ebx,[ebx+8]
206
		mov [eax+GLContext.polygon_mode_front],ebx
6523 IgorA 207
		jmp .end_f
5153 IgorA 208
	@@:
209
	cmp dword[ebx+4],GL_FRONT_AND_BACK
210
	jne @f
211
		mov ebx,[ebx+8]
212
		mov [eax+GLContext.polygon_mode_front],ebx
6523 IgorA 213
		mov [eax+GLContext.polygon_mode_back],ebx
214
		jmp .end_f
5153 IgorA 215
	@@:
216
;    assert(0);
217
	.end_f:
218
	ret
219
endp
220
221
 
222
proc glopHint, context:dword,p:dword
223
if 0
224
;  int target=p[1].i;
225
;  int mode=p[2].i;
226
227
 
228
end if
229
	ret
230
endp
231
232
 
233
proc glopPolygonOffset uses eax ebx ecx, context:dword,p:dword
234
	mov eax,[context]
235
	mov ebx,[p]
236
	mov ecx,[ebx+4]
237
	mov [eax+GLContext.offset_factor],ecx
6523 IgorA 238
	mov ecx,[ebx+8]
5153 IgorA 239
	mov [eax+GLContext.offset_units],ecx
6523 IgorA 240
	ret
5153 IgorA 241
endp
242