347 |
347 |
|
348 |
348 |
private int oitRender(long currTime, DistortedOutputSurface buffer)
|
349 |
349 |
{
|
|
350 |
if( buffer==this )
|
|
351 |
{
|
|
352 |
android.util.Log.e("surface", "feedback loop in oitRender!");
|
|
353 |
return 0;
|
|
354 |
}
|
|
355 |
|
350 |
356 |
GLES31.glViewport(0, 0, mWidth, mHeight);
|
351 |
357 |
setAsOutput(currTime);
|
352 |
358 |
GLES31.glActiveTexture(GLES31.GL_TEXTURE0);
|
... | ... | |
354 |
360 |
GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
|
355 |
361 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, buffer.mDepthStencilH[0]);
|
356 |
362 |
|
357 |
|
DistortedRenderState.enableStencil();
|
358 |
|
|
359 |
|
// we have to unbind DEPTH buffer lest we create a feedback loop
|
360 |
|
|
361 |
|
if( mDepthStencil==BOTH_DEPTH_STENCIL )
|
362 |
|
{
|
363 |
|
GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, 0, 0);
|
364 |
|
}
|
365 |
|
else if( mDepthStencil==DEPTH_NO_STENCIL )
|
366 |
|
{
|
367 |
|
GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_ATTACHMENT , GLES31.GL_TEXTURE_2D, 0, 0);
|
368 |
|
}
|
|
363 |
GLES31.glDisable(GLES31.GL_STENCIL_TEST);
|
|
364 |
GLES31.glStencilMask(0x00);
|
369 |
365 |
|
370 |
366 |
DistortedEffects.oitRender(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
|
371 |
367 |
|
372 |
|
if( mDepthStencil==BOTH_DEPTH_STENCIL )
|
373 |
|
{
|
374 |
|
GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, mDepthStencilH[0], 0);
|
375 |
|
}
|
376 |
|
else if( mDepthStencil==DEPTH_NO_STENCIL )
|
377 |
|
{
|
378 |
|
GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_ATTACHMENT , GLES31.GL_TEXTURE_2D, mDepthStencilH[0], 0);
|
379 |
|
}
|
380 |
|
|
381 |
368 |
GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
|
382 |
369 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
|
383 |
370 |
|
384 |
|
DistortedRenderState.restoreStencil();
|
385 |
|
|
386 |
371 |
return 1;
|
387 |
372 |
}
|
388 |
373 |
|
correct oitRenddr again; correct coming to paused state (we could crash)