Revision e6519ac8
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedRenderState.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.library.main; |
21 | 21 |
|
22 |
import android.opengl.GLES30;
|
|
22 |
import android.opengl.GLES31;
|
|
23 | 23 |
|
24 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
25 | 25 |
/** |
... | ... | |
71 | 71 |
|
72 | 72 |
mState.depthTest = 1; |
73 | 73 |
mState.depthMask = 1; |
74 |
mState.depthFunc = GLES30.GL_LEQUAL;
|
|
74 |
mState.depthFunc = GLES31.GL_LEQUAL;
|
|
75 | 75 |
|
76 | 76 |
mState.blend = 1; |
77 |
mState.blendSrc = GLES30.GL_SRC_ALPHA;
|
|
78 |
mState.blendDst = GLES30.GL_ONE_MINUS_SRC_ALPHA;
|
|
77 |
mState.blendSrc = GLES31.GL_SRC_ALPHA;
|
|
78 |
mState.blendDst = GLES31.GL_ONE_MINUS_SRC_ALPHA;
|
|
79 | 79 |
|
80 | 80 |
mState.stencilTest = 0; |
81 | 81 |
mState.stencilMask = STENCIL_MASK; |
82 |
mState.stencilFuncFunc = GLES30.GL_NEVER;
|
|
82 |
mState.stencilFuncFunc = GLES31.GL_NEVER;
|
|
83 | 83 |
mState.stencilFuncRef = 0; |
84 | 84 |
mState.stencilFuncMask = STENCIL_MASK; |
85 |
mState.stencilOpSfail = GLES30.GL_KEEP;
|
|
86 |
mState.stencilOpDpfail = GLES30.GL_KEEP;
|
|
87 |
mState.stencilOpDppass = GLES30.GL_KEEP;
|
|
85 |
mState.stencilOpSfail = GLES31.GL_KEEP;
|
|
86 |
mState.stencilOpDpfail = GLES31.GL_KEEP;
|
|
87 |
mState.stencilOpDppass = GLES31.GL_KEEP;
|
|
88 | 88 |
|
89 | 89 |
mClear = 0; |
90 | 90 |
} |
... | ... | |
98 | 98 |
cState.colorMaskG = 1; |
99 | 99 |
cState.colorMaskB = 1; |
100 | 100 |
cState.colorMaskA = 1; |
101 |
GLES30.glColorMask(true,true,true,true);
|
|
101 |
GLES31.glColorMask(true,true,true,true);
|
|
102 | 102 |
|
103 | 103 |
cState.depthTest = 1; |
104 | 104 |
cState.depthMask = 1; |
105 |
cState.depthFunc = GLES30.GL_LEQUAL;
|
|
106 |
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
|
|
107 |
GLES30.glDepthMask(true);
|
|
108 |
GLES30.glDepthFunc(cState.depthFunc);
|
|
105 |
cState.depthFunc = GLES31.GL_LEQUAL;
|
|
106 |
GLES31.glEnable(GLES31.GL_DEPTH_TEST);
|
|
107 |
GLES31.glDepthMask(true);
|
|
108 |
GLES31.glDepthFunc(cState.depthFunc);
|
|
109 | 109 |
|
110 | 110 |
cState.stencilTest = 0; |
111 | 111 |
cState.stencilMask = STENCIL_MASK; |
112 |
cState.stencilFuncFunc = GLES30.GL_NEVER;
|
|
112 |
cState.stencilFuncFunc = GLES31.GL_NEVER;
|
|
113 | 113 |
cState.stencilFuncRef = 0; |
114 | 114 |
cState.stencilFuncMask = STENCIL_MASK; |
115 |
cState.stencilOpSfail = GLES30.GL_KEEP;
|
|
116 |
cState.stencilOpDpfail = GLES30.GL_KEEP;
|
|
117 |
cState.stencilOpDppass = GLES30.GL_KEEP;
|
|
118 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST);
|
|
119 |
GLES30.glStencilMask(cState.stencilMask);
|
|
115 |
cState.stencilOpSfail = GLES31.GL_KEEP;
|
|
116 |
cState.stencilOpDpfail = GLES31.GL_KEEP;
|
|
117 |
cState.stencilOpDppass = GLES31.GL_KEEP;
|
|
118 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST);
|
|
119 |
GLES31.glStencilMask(cState.stencilMask);
|
|
120 | 120 |
|
121 | 121 |
cState.blend = 1; |
122 |
cState.blendSrc = GLES30.GL_SRC_ALPHA;
|
|
123 |
cState.blendDst = GLES30.GL_ONE_MINUS_SRC_ALPHA;
|
|
124 |
GLES30.glEnable(GLES30.GL_BLEND);
|
|
125 |
GLES30.glBlendFunc(cState.blendSrc,cState.blendDst);
|
|
122 |
cState.blendSrc = GLES31.GL_SRC_ALPHA;
|
|
123 |
cState.blendDst = GLES31.GL_ONE_MINUS_SRC_ALPHA;
|
|
124 |
GLES31.glEnable(GLES31.GL_BLEND);
|
|
125 |
GLES31.glBlendFunc(cState.blendSrc,cState.blendDst);
|
|
126 | 126 |
} |
127 | 127 |
|
128 | 128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
140 | 140 |
cState.colorMaskG = 1; |
141 | 141 |
cState.colorMaskB = 1; |
142 | 142 |
cState.colorMaskA = 1; |
143 |
GLES30.glColorMask(true,true,true,true);
|
|
143 |
GLES31.glColorMask(true,true,true,true);
|
|
144 | 144 |
} |
145 | 145 |
|
146 | 146 |
sState.depthMask = cState.depthMask; |
... | ... | |
148 | 148 |
if( cState.depthMask!=1 ) |
149 | 149 |
{ |
150 | 150 |
cState.depthMask = 1; |
151 |
GLES30.glDepthMask(true);
|
|
151 |
GLES31.glDepthMask(true);
|
|
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
sState.stencilMask = cState.stencilMask; |
... | ... | |
156 | 156 |
if( cState.stencilMask!= STENCIL_MASK ) |
157 | 157 |
{ |
158 | 158 |
cState.stencilMask = STENCIL_MASK; |
159 |
GLES30.glStencilMask(cState.stencilMask);
|
|
159 |
GLES31.glStencilMask(cState.stencilMask);
|
|
160 | 160 |
} |
161 | 161 |
} |
162 | 162 |
|
... | ... | |
170 | 170 |
cState.colorMaskG = sState.colorMaskG; |
171 | 171 |
cState.colorMaskB = sState.colorMaskB; |
172 | 172 |
cState.colorMaskA = sState.colorMaskA; |
173 |
GLES30.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
173 |
GLES31.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
174 | 174 |
} |
175 | 175 |
if( sState.depthMask!=cState.depthMask ) |
176 | 176 |
{ |
177 | 177 |
cState.depthMask = sState.depthMask; |
178 |
GLES30.glDepthMask(cState.depthMask==1);
|
|
178 |
GLES31.glDepthMask(cState.depthMask==1);
|
|
179 | 179 |
} |
180 | 180 |
if( sState.stencilMask!=cState.stencilMask ) |
181 | 181 |
{ |
182 | 182 |
cState.stencilMask = sState.stencilMask; |
183 |
GLES30.glStencilMask(cState.stencilMask);
|
|
183 |
GLES31.glStencilMask(cState.stencilMask);
|
|
184 | 184 |
} |
185 | 185 |
} |
186 | 186 |
|
... | ... | |
188 | 188 |
|
189 | 189 |
static void switchOffDrawing() |
190 | 190 |
{ |
191 |
GLES30.glEnable(GLES30.GL_SCISSOR_TEST);
|
|
192 |
GLES30.glScissor(0,0,0,0);
|
|
191 |
GLES31.glEnable(GLES31.GL_SCISSOR_TEST);
|
|
192 |
GLES31.glScissor(0,0,0,0);
|
|
193 | 193 |
} |
194 | 194 |
|
195 | 195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
196 | 196 |
|
197 | 197 |
static void restoreDrawing() |
198 | 198 |
{ |
199 |
GLES30.glDisable(GLES30.GL_SCISSOR_TEST);
|
|
199 |
GLES31.glDisable(GLES31.GL_SCISSOR_TEST);
|
|
200 | 200 |
} |
201 | 201 |
|
202 | 202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
209 | 209 |
{ |
210 | 210 |
cState.stencilTest = 1; |
211 | 211 |
//android.util.Log.d("State", "stencil test on"); |
212 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST);
|
|
212 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST);
|
|
213 | 213 |
} |
214 | 214 |
|
215 | 215 |
sState.stencilFuncFunc = cState.stencilFuncFunc; |
216 | 216 |
sState.stencilFuncRef = cState.stencilFuncRef; |
217 | 217 |
sState.stencilFuncMask = cState.stencilFuncMask; |
218 | 218 |
|
219 |
if( cState.stencilFuncFunc!=GLES30.GL_ALWAYS || cState.stencilFuncRef!=1 || cState.stencilFuncMask!=STENCIL_MASK )
|
|
219 |
if( cState.stencilFuncFunc!=GLES31.GL_ALWAYS || cState.stencilFuncRef!=1 || cState.stencilFuncMask!=STENCIL_MASK )
|
|
220 | 220 |
{ |
221 |
cState.stencilFuncFunc = GLES30.GL_ALWAYS;
|
|
221 |
cState.stencilFuncFunc = GLES31.GL_ALWAYS;
|
|
222 | 222 |
cState.stencilFuncRef = 1; |
223 | 223 |
cState.stencilFuncMask = STENCIL_MASK; |
224 | 224 |
//android.util.Log.d("State", "stencil func on"); |
225 |
GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
225 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
226 | 226 |
} |
227 | 227 |
|
228 | 228 |
sState.stencilOpSfail = cState.stencilOpSfail; |
229 | 229 |
sState.stencilOpDpfail= cState.stencilOpDpfail; |
230 | 230 |
sState.stencilOpDppass= cState.stencilOpDppass; |
231 | 231 |
|
232 |
if( cState.stencilOpSfail!=GLES30.GL_KEEP || cState.stencilOpDpfail!=GLES30.GL_KEEP || cState.stencilOpDppass!=GLES30.GL_REPLACE )
|
|
232 |
if( cState.stencilOpSfail!=GLES31.GL_KEEP || cState.stencilOpDpfail!=GLES31.GL_KEEP || cState.stencilOpDppass!=GLES31.GL_REPLACE )
|
|
233 | 233 |
{ |
234 |
cState.stencilOpSfail = GLES30.GL_KEEP;
|
|
235 |
cState.stencilOpDpfail= GLES30.GL_KEEP;
|
|
236 |
cState.stencilOpDppass= GLES30.GL_REPLACE;
|
|
234 |
cState.stencilOpSfail = GLES31.GL_KEEP;
|
|
235 |
cState.stencilOpDpfail= GLES31.GL_KEEP;
|
|
236 |
cState.stencilOpDppass= GLES31.GL_REPLACE;
|
|
237 | 237 |
//android.util.Log.d("State", "stencil op on"); |
238 |
GLES30.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass);
|
|
238 |
GLES31.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass);
|
|
239 | 239 |
} |
240 | 240 |
|
241 | 241 |
sState.colorMaskR = cState.colorMaskR; |
... | ... | |
250 | 250 |
cState.colorMaskB = 0; |
251 | 251 |
cState.colorMaskA = 0; |
252 | 252 |
//android.util.Log.d("State", "switch off color writing"); |
253 |
GLES30.glColorMask(false,false,false,false);
|
|
253 |
GLES31.glColorMask(false,false,false,false);
|
|
254 | 254 |
} |
255 | 255 |
|
256 | 256 |
sState.depthMask = cState.depthMask; |
... | ... | |
259 | 259 |
{ |
260 | 260 |
cState.depthMask = 1; |
261 | 261 |
//android.util.Log.d("State", "switch on depth writing"); |
262 |
GLES30.glDepthMask(true);
|
|
262 |
GLES31.glDepthMask(true);
|
|
263 | 263 |
} |
264 | 264 |
|
265 | 265 |
sState.stencilMask = cState.stencilMask; |
... | ... | |
268 | 268 |
{ |
269 | 269 |
cState.stencilMask = STENCIL_MASK; |
270 | 270 |
//android.util.Log.d("State", "stencil mask on"); |
271 |
GLES30.glStencilMask(cState.stencilMask);
|
|
271 |
GLES31.glStencilMask(cState.stencilMask);
|
|
272 | 272 |
} |
273 | 273 |
} |
274 | 274 |
|
... | ... | |
282 | 282 |
|
283 | 283 |
if (cState.stencilTest == 0) |
284 | 284 |
{ |
285 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST);
|
|
285 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST);
|
|
286 | 286 |
} |
287 | 287 |
else |
288 | 288 |
{ |
289 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST);
|
|
289 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST);
|
|
290 | 290 |
} |
291 | 291 |
} |
292 | 292 |
if( sState.colorMaskR!=cState.colorMaskR || sState.colorMaskG!=cState.colorMaskG || sState.colorMaskB!=cState.colorMaskB || sState.colorMaskA!=cState.colorMaskA) |
... | ... | |
295 | 295 |
cState.colorMaskG = sState.colorMaskG; |
296 | 296 |
cState.colorMaskB = sState.colorMaskB; |
297 | 297 |
cState.colorMaskA = sState.colorMaskA; |
298 |
GLES30.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
298 |
GLES31.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
299 | 299 |
} |
300 | 300 |
if( sState.depthMask!=cState.depthMask ) |
301 | 301 |
{ |
302 | 302 |
cState.depthMask = sState.depthMask; |
303 |
GLES30.glDepthMask(cState.depthMask==1);
|
|
303 |
GLES31.glDepthMask(cState.depthMask==1);
|
|
304 | 304 |
} |
305 | 305 |
if( sState.stencilMask!=cState.stencilMask ) |
306 | 306 |
{ |
307 | 307 |
cState.stencilMask = sState.stencilMask; |
308 |
GLES30.glStencilMask(cState.stencilMask);
|
|
308 |
GLES31.glStencilMask(cState.stencilMask);
|
|
309 | 309 |
} |
310 | 310 |
} |
311 | 311 |
|
... | ... | |
322 | 322 |
if( cState.stencilTest!=1 ) |
323 | 323 |
{ |
324 | 324 |
cState.stencilTest = 1; |
325 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST);
|
|
325 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST);
|
|
326 | 326 |
} |
327 | 327 |
|
328 | 328 |
sState.stencilFuncFunc = cState.stencilFuncFunc; |
329 | 329 |
sState.stencilFuncRef = cState.stencilFuncRef; |
330 | 330 |
sState.stencilFuncMask = cState.stencilFuncMask; |
331 | 331 |
|
332 |
if( cState.stencilFuncFunc!=GLES30.GL_EQUAL || cState.stencilFuncRef!=1 || cState.stencilFuncMask!=STENCIL_MASK )
|
|
332 |
if( cState.stencilFuncFunc!=GLES31.GL_EQUAL || cState.stencilFuncRef!=1 || cState.stencilFuncMask!=STENCIL_MASK )
|
|
333 | 333 |
{ |
334 |
cState.stencilFuncFunc = GLES30.GL_EQUAL;
|
|
334 |
cState.stencilFuncFunc = GLES31.GL_EQUAL;
|
|
335 | 335 |
cState.stencilFuncRef = 1; |
336 | 336 |
cState.stencilFuncMask = STENCIL_MASK; |
337 |
GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
337 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
338 | 338 |
} |
339 | 339 |
|
340 | 340 |
sState.stencilMask = cState.stencilMask; |
... | ... | |
342 | 342 |
if( cState.stencilMask!= 0x00 ) |
343 | 343 |
{ |
344 | 344 |
cState.stencilMask = 0x00; |
345 |
GLES30.glStencilMask(cState.stencilMask);
|
|
345 |
GLES31.glStencilMask(cState.stencilMask);
|
|
346 | 346 |
} |
347 | 347 |
|
348 | 348 |
sState.depthMask = cState.depthMask; |
... | ... | |
350 | 350 |
if( cState.depthMask!=0 ) |
351 | 351 |
{ |
352 | 352 |
cState.depthMask = 0; |
353 |
GLES30.glDepthMask(false);
|
|
353 |
GLES31.glDepthMask(false);
|
|
354 | 354 |
} |
355 | 355 |
|
356 | 356 |
sState.depthTest = cState.depthTest; |
... | ... | |
358 | 358 |
if( cState.depthTest!=0 ) |
359 | 359 |
{ |
360 | 360 |
cState.depthTest = 0; |
361 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST);
|
|
361 |
GLES31.glDisable(GLES31.GL_DEPTH_TEST);
|
|
362 | 362 |
} |
363 | 363 |
} |
364 | 364 |
|
... | ... | |
376 | 376 |
|
377 | 377 |
if (cState.stencilTest == 0) |
378 | 378 |
{ |
379 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST);
|
|
379 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST);
|
|
380 | 380 |
} |
381 | 381 |
else |
382 | 382 |
{ |
383 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST);
|
|
383 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST);
|
|
384 | 384 |
} |
385 | 385 |
} |
386 | 386 |
if( sState.stencilFuncFunc!=cState.stencilFuncFunc || sState.stencilFuncRef!=cState.stencilFuncRef || sState.stencilFuncMask!=cState.stencilFuncMask ) |
... | ... | |
388 | 388 |
cState.stencilFuncFunc = sState.stencilFuncFunc; |
389 | 389 |
cState.stencilFuncRef = sState.stencilFuncRef ; |
390 | 390 |
cState.stencilFuncMask = sState.stencilFuncMask; |
391 |
GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
391 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
392 | 392 |
} |
393 | 393 |
if( sState.stencilMask!=cState.stencilMask ) |
394 | 394 |
{ |
395 | 395 |
cState.stencilMask = sState.stencilMask; |
396 |
GLES30.glStencilMask(cState.stencilMask);
|
|
396 |
GLES31.glStencilMask(cState.stencilMask);
|
|
397 | 397 |
} |
398 | 398 |
if( sState.depthMask!=cState.depthMask ) |
399 | 399 |
{ |
400 | 400 |
cState.depthMask = sState.depthMask; |
401 |
GLES30.glDepthMask(cState.depthMask==1);
|
|
401 |
GLES31.glDepthMask(cState.depthMask==1);
|
|
402 | 402 |
} |
403 | 403 |
if( sState.depthTest!=cState.depthTest ) |
404 | 404 |
{ |
... | ... | |
406 | 406 |
|
407 | 407 |
if (cState.depthTest == 0) |
408 | 408 |
{ |
409 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST);
|
|
409 |
GLES31.glDisable(GLES31.GL_DEPTH_TEST);
|
|
410 | 410 |
} |
411 | 411 |
else |
412 | 412 |
{ |
413 |
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
|
|
413 |
GLES31.glEnable(GLES31.GL_DEPTH_TEST);
|
|
414 | 414 |
} |
415 | 415 |
} |
416 | 416 |
} |
... | ... | |
430 | 430 |
cState.colorMaskG = mState.colorMaskG; |
431 | 431 |
cState.colorMaskB = mState.colorMaskB; |
432 | 432 |
cState.colorMaskA = mState.colorMaskA; |
433 |
GLES30.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
433 |
GLES31.glColorMask(cState.colorMaskR==1,cState.colorMaskG==1,cState.colorMaskB==1,cState.colorMaskA==1);
|
|
434 | 434 |
} |
435 | 435 |
|
436 | 436 |
///////////////////////////////////////////////////// |
... | ... | |
442 | 442 |
if (cState.depthTest == 0) |
443 | 443 |
{ |
444 | 444 |
//android.util.Log.d("State", "disabling depth test"); |
445 |
GLES30.glDisable(GLES30.GL_DEPTH_TEST);
|
|
445 |
GLES31.glDisable(GLES31.GL_DEPTH_TEST);
|
|
446 | 446 |
} |
447 | 447 |
else |
448 | 448 |
{ |
449 | 449 |
//android.util.Log.d("State", "enable depth test"); |
450 |
GLES30.glEnable(GLES30.GL_DEPTH_TEST);
|
|
450 |
GLES31.glEnable(GLES31.GL_DEPTH_TEST);
|
|
451 | 451 |
} |
452 | 452 |
} |
453 | 453 |
|
... | ... | |
457 | 457 |
{ |
458 | 458 |
//android.util.Log.d("State", "setting depth func"); |
459 | 459 |
cState.depthFunc = mState.depthFunc; |
460 |
GLES30.glDepthFunc(cState.depthFunc);
|
|
460 |
GLES31.glDepthFunc(cState.depthFunc);
|
|
461 | 461 |
} |
462 | 462 |
|
463 | 463 |
///////////////////////////////////////////////////// |
... | ... | |
466 | 466 |
{ |
467 | 467 |
//android.util.Log.d("State", "setting depth mask"); |
468 | 468 |
cState.depthMask = mState.depthMask; |
469 |
GLES30.glDepthMask(cState.depthMask==1);
|
|
469 |
GLES31.glDepthMask(cState.depthMask==1);
|
|
470 | 470 |
} |
471 | 471 |
|
472 | 472 |
///////////////////////////////////////////////////// |
... | ... | |
478 | 478 |
if (cState.blend == 0) |
479 | 479 |
{ |
480 | 480 |
//android.util.Log.d("State", "disabling blending"); |
481 |
GLES30.glDisable(GLES30.GL_BLEND);
|
|
481 |
GLES31.glDisable(GLES31.GL_BLEND);
|
|
482 | 482 |
} |
483 | 483 |
else |
484 | 484 |
{ |
485 | 485 |
//android.util.Log.d("State", "enabling blending"); |
486 |
GLES30.glEnable(GLES30.GL_BLEND);
|
|
486 |
GLES31.glEnable(GLES31.GL_BLEND);
|
|
487 | 487 |
} |
488 | 488 |
} |
489 | 489 |
|
... | ... | |
494 | 494 |
//android.util.Log.d("State", "setting blend function"); |
495 | 495 |
cState.blendSrc = mState.blendSrc; |
496 | 496 |
cState.blendDst = mState.blendDst; |
497 |
GLES30.glBlendFunc(cState.blendSrc,cState.blendDst);
|
|
497 |
GLES31.glBlendFunc(cState.blendSrc,cState.blendDst);
|
|
498 | 498 |
} |
499 | 499 |
|
500 | 500 |
///////////////////////////////////////////////////// |
... | ... | |
506 | 506 |
if (cState.stencilTest == 0) |
507 | 507 |
{ |
508 | 508 |
//android.util.Log.d("State", "disabling stencil test"); |
509 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST);
|
|
509 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST);
|
|
510 | 510 |
} |
511 | 511 |
else |
512 | 512 |
{ |
513 | 513 |
//android.util.Log.d("State", "enabling stencil test"); |
514 |
GLES30.glEnable(GLES30.GL_STENCIL_TEST);
|
|
514 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST);
|
|
515 | 515 |
} |
516 | 516 |
} |
517 | 517 |
|
... | ... | |
523 | 523 |
cState.stencilFuncFunc = mState.stencilFuncFunc; |
524 | 524 |
cState.stencilFuncRef = mState.stencilFuncRef ; |
525 | 525 |
cState.stencilFuncMask = mState.stencilFuncMask; |
526 |
GLES30.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
526 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask);
|
|
527 | 527 |
} |
528 | 528 |
|
529 | 529 |
///////////////////////////////////////////////////// |
... | ... | |
534 | 534 |
cState.stencilOpSfail = mState.stencilOpSfail; |
535 | 535 |
cState.stencilOpDpfail= mState.stencilOpDpfail; |
536 | 536 |
cState.stencilOpDppass= mState.stencilOpDppass; |
537 |
GLES30.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass);
|
|
537 |
GLES31.glStencilOp(cState.stencilOpSfail,cState.stencilOpDpfail,cState.stencilOpDppass);
|
|
538 | 538 |
} |
539 | 539 |
|
540 | 540 |
///////////////////////////////////////////////////// |
... | ... | |
543 | 543 |
{ |
544 | 544 |
//android.util.Log.d("State", "setting stencil mask"); |
545 | 545 |
cState.stencilMask = mState.stencilMask; |
546 |
GLES30.glStencilMask(cState.stencilMask);
|
|
546 |
GLES31.glStencilMask(cState.stencilMask);
|
|
547 | 547 |
} |
548 | 548 |
|
549 | 549 |
///////////////////////////////////////////////////// |
... | ... | |
551 | 551 |
if( mClear!=0 ) |
552 | 552 |
{ |
553 | 553 |
//android.util.Log.d("State", "clearing buffer"); |
554 |
GLES30.glClear(mClear);
|
|
554 |
GLES31.glClear(mClear);
|
|
555 | 555 |
} |
556 | 556 |
} |
557 | 557 |
|
... | ... | |
583 | 583 |
|
584 | 584 |
void glEnable(int test) |
585 | 585 |
{ |
586 |
if( test==GLES30.GL_DEPTH_TEST ) mState.depthTest = 1;
|
|
587 |
else if( test==GLES30.GL_STENCIL_TEST ) mState.stencilTest = 1;
|
|
588 |
else if( test==GLES30.GL_BLEND ) mState.blend = 1;
|
|
586 |
if( test==GLES31.GL_DEPTH_TEST ) mState.depthTest = 1;
|
|
587 |
else if( test==GLES31.GL_STENCIL_TEST ) mState.stencilTest = 1;
|
|
588 |
else if( test==GLES31.GL_BLEND ) mState.blend = 1;
|
|
589 | 589 |
} |
590 | 590 |
|
591 | 591 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
592 | 592 |
|
593 | 593 |
void glDisable(int test) |
594 | 594 |
{ |
595 |
if( test==GLES30.GL_DEPTH_TEST ) mState.depthTest = 0;
|
|
596 |
else if( test==GLES30.GL_STENCIL_TEST ) mState.stencilTest = 0;
|
|
597 |
else if( test==GLES30.GL_BLEND ) mState.blend = 0;
|
|
595 |
if( test==GLES31.GL_DEPTH_TEST ) mState.depthTest = 0;
|
|
596 |
else if( test==GLES31.GL_STENCIL_TEST ) mState.stencilTest = 0;
|
|
597 |
else if( test==GLES31.GL_BLEND ) mState.blend = 0;
|
|
598 | 598 |
} |
599 | 599 |
|
600 | 600 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Up library requirements to OpenGL ES 3.1 (needed for the upcoming GL_SHADER_STORAGE_BUFFER)