Revision ad16ed3b
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedRenderState.java | ||
---|---|---|
24 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
25 | 25 |
/** |
26 | 26 |
* Remember the OpenGL state. |
27 |
* <p> |
|
28 |
* This is a member of DistortedNode. Remembers the OpenGL state we want to set just before rendering |
|
29 |
* the Node. |
|
27 | 30 |
*/ |
28 | 31 |
class DistortedRenderState |
29 | 32 |
{ |
30 |
private static int sColorMaskR, sColorMaskG, sColorMaskB, sColorMaskA; |
|
31 |
private static int sDepthMask; |
|
32 |
private static int sStencilMask; |
|
33 |
private static int sDepthTest; |
|
34 |
private static int sStencilTest; |
|
35 |
private static int sStencilFuncFunc, sStencilFuncRef, sStencilFuncMask; |
|
36 |
private static int sStencilOpSfail, sStencilOpDpfail, sStencilOpDppass; |
|
37 |
private static int sDepthFunc; |
|
38 |
private static int sBlend; |
|
39 |
private static int sBlendSrc, sBlendDst; |
|
40 |
|
|
41 |
private int mColorMaskR, mColorMaskG, mColorMaskB, mColorMaskA; |
|
42 |
private int mDepthMask; |
|
43 |
private int mStencilMask; |
|
44 |
private int mDepthTest; |
|
45 |
private int mStencilTest; |
|
46 |
private int mStencilFuncFunc, mStencilFuncRef, mStencilFuncMask; |
|
47 |
private int mStencilOpSfail, mStencilOpDpfail, mStencilOpDppass; |
|
48 |
private int mDepthFunc; |
|
49 |
private int mBlend; |
|
50 |
private int mBlendSrc, mBlendDst; |
|
33 |
private static int sColorMaskR, sColorMaskG, sColorMaskB, sColorMaskA; // |
|
34 |
private static int sDepthMask; // |
|
35 |
private static int sStencilMask; // |
|
36 |
private static int sDepthTest; // |
|
37 |
private static int sStencilTest; // |
|
38 |
private static int sStencilFuncFunc, sStencilFuncRef, sStencilFuncMask; // current OpenGL state |
|
39 |
private static int sStencilOpSfail, sStencilOpDpfail, sStencilOpDppass; // |
|
40 |
private static int sDepthFunc; // |
|
41 |
private static int sBlend; // |
|
42 |
private static int sBlendSrc, sBlendDst; // |
|
43 |
|
|
44 |
private int mColorMaskR, mColorMaskG, mColorMaskB, mColorMaskA; // |
|
45 |
private int mDepthMask; // |
|
46 |
private int mStencilMask; // |
|
47 |
private int mDepthTest; // |
|
48 |
private int mStencilTest; // |
|
49 |
private int mStencilFuncFunc, mStencilFuncRef, mStencilFuncMask; // The state we want to have |
|
50 |
private int mStencilOpSfail, mStencilOpDpfail, mStencilOpDppass; // |
|
51 |
private int mDepthFunc; // |
|
52 |
private int mBlend; // |
|
53 |
private int mBlendSrc, mBlendDst; // |
|
54 |
private int mClear; // This does not have a 'static' compatriot |
|
51 | 55 |
|
52 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 57 |
// default: color writes on, depth test and writes on, blending on, stencil off. |
... | ... | |
75 | 79 |
mStencilOpSfail = GLES30.GL_KEEP; |
76 | 80 |
mStencilOpDpfail = GLES30.GL_KEEP; |
77 | 81 |
mStencilOpDppass = GLES30.GL_KEEP; |
82 |
|
|
83 |
mClear = 0; |
|
78 | 84 |
} |
79 | 85 |
|
80 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
237 | 243 |
sStencilMask = mStencilMask; |
238 | 244 |
GLES30.glStencilMask(sStencilMask); |
239 | 245 |
} |
246 |
|
|
247 |
// 7. Clear buffers? |
|
248 |
|
|
249 |
if( mClear!=0 ) |
|
250 |
{ |
|
251 |
GLES30.glClear(mClear); |
|
252 |
} |
|
240 | 253 |
} |
241 | 254 |
|
242 | 255 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
314 | 327 |
mBlendDst = dst; |
315 | 328 |
} |
316 | 329 |
|
330 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
331 |
|
|
332 |
void glClear(int mask) |
|
333 |
{ |
|
334 |
mClear = mask; |
|
335 |
} |
|
317 | 336 |
} |
Also available in: Unified diff
Progress with Stencil App; should be working now AFAIK but doesn't.