Revision 8777ce17
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedRenderState.java | ||
---|---|---|
199 | 199 |
GLES31.glDisable(GLES31.GL_SCISSOR_TEST); |
200 | 200 |
} |
201 | 201 |
|
202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
203 |
|
|
204 |
static void enableStencil() |
|
205 |
{ |
|
206 |
sState.stencilTest = cState.stencilTest; |
|
207 |
|
|
208 |
if (cState.stencilTest != 1) |
|
209 |
{ |
|
210 |
cState.stencilTest = 1; |
|
211 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST); |
|
212 |
} |
|
213 |
|
|
214 |
sState.stencilFuncFunc = cState.stencilFuncFunc; |
|
215 |
sState.stencilFuncRef = cState.stencilFuncRef; |
|
216 |
sState.stencilFuncMask = cState.stencilFuncMask; |
|
217 |
|
|
218 |
if( cState.stencilFuncFunc!=GLES31.GL_EQUAL || cState.stencilFuncRef!=1 || cState.stencilFuncMask!=STENCIL_MASK ) |
|
219 |
{ |
|
220 |
cState.stencilFuncFunc = GLES31.GL_EQUAL; |
|
221 |
cState.stencilFuncRef = 1; |
|
222 |
cState.stencilFuncMask = STENCIL_MASK; |
|
223 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask); |
|
224 |
} |
|
225 |
|
|
226 |
sState.stencilMask = cState.stencilMask; |
|
227 |
|
|
228 |
if( cState.stencilMask!= 0x00 ) |
|
229 |
{ |
|
230 |
cState.stencilMask = 0x00; |
|
231 |
GLES31.glStencilMask(cState.stencilMask); |
|
232 |
} |
|
233 |
} |
|
234 |
|
|
235 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
236 |
|
|
237 |
static void restoreStencil() |
|
238 |
{ |
|
239 |
if (sState.stencilTest != cState.stencilTest) |
|
240 |
{ |
|
241 |
cState.stencilTest = sState.stencilTest; |
|
242 |
|
|
243 |
if (cState.stencilTest == 0) |
|
244 |
{ |
|
245 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST); |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
GLES31.glEnable(GLES31.GL_STENCIL_TEST); |
|
250 |
} |
|
251 |
} |
|
252 |
if( sState.stencilFuncFunc!=cState.stencilFuncFunc || sState.stencilFuncRef!=cState.stencilFuncRef || sState.stencilFuncMask!=cState.stencilFuncMask ) |
|
253 |
{ |
|
254 |
cState.stencilFuncFunc = sState.stencilFuncFunc; |
|
255 |
cState.stencilFuncRef = sState.stencilFuncRef ; |
|
256 |
cState.stencilFuncMask = sState.stencilFuncMask; |
|
257 |
GLES31.glStencilFunc(cState.stencilFuncFunc,cState.stencilFuncRef,cState.stencilFuncMask); |
|
258 |
} |
|
259 |
if( sState.stencilMask!=cState.stencilMask ) |
|
260 |
{ |
|
261 |
cState.stencilMask = sState.stencilMask; |
|
262 |
GLES31.glStencilMask(cState.stencilMask); |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
202 | 266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
203 | 267 |
|
204 | 268 |
static void setUpStencilMark() |
Also available in: Unified diff
Order Independent Transparency. Does not work yet.