diff options
author | Sven Gothel <[email protected]> | 2014-04-10 00:31:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-10 00:31:52 +0200 |
commit | 45395696c252c215a8a22d05e5da7e98c662d07e (patch) | |
tree | 952c132450f7cc56aeed0bb1fc040bde5f3ba96a /src/jogl/classes/jogamp | |
parent | 16324b8f8369379ab4db013c4785a496b25c7094 (diff) |
Bug 801: Introd. RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED hinting to deal w/ GL_DEPTH_TEST accordingly
Fixes VBORegion2PMSAAES2 no-depth-buffer usage
and allows user to control behavior w/o quering GL state.
If BITHINT_GLOBAL_DEPTH_TEST_ENABLED set:
- RegionRenderer.defaultBlendEnable: glDepthMask(false)
- RegionRenderer.defaultBlendDisable: glDepthMask(true)
- VBORegion2PMSAAES2 enables/disables GL_DEPTH_TEST, otherwise MSAA is corrupt.
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index b52308e05..d870644f3 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -407,7 +407,12 @@ public class VBORegion2PMSAAES2 extends GLRegion { private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height, final int sampleCount) { gl.glViewport(0, 0, width, height); - if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { + if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED | RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + // RGB is already multiplied w/ alpha via renderRegion2FBO(..) + gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); + gl.glEnable(GL.GL_DEPTH_TEST); + + } else if( rs.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { // RGB is already multiplied w/ alpha via renderRegion2FBO(..) gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); } @@ -459,7 +464,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { fbo.setSamplingSink(ssink); fbo.resetSamplingSink(gl); // validate if( DEBUG_FBO_1 ) { - System.err.printf("XXX.createFBO: %dx%d%n%s%n", fboWidth, fboHeight, fbo.toString()); + System.err.printf("XXX.createFBO: blending %b, %dx%d%n%s%n", blendingEnabled, fboWidth, fboHeight, fbo.toString()); } } else if( targetFboWidth != fboWidth || targetFboHeight != fboHeight || fbo.getNumSamples() != sampleCount[0] ) { fbo.reset(gl, targetFboWidth, targetFboHeight, sampleCount[0], true /* resetSamplingSink */); @@ -482,6 +487,10 @@ public class VBORegion2PMSAAES2 extends GLRegion { // Multiply RGB w/ Alpha, preserve alpha for renderFBO(..) gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); + + if( rs.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) { + gl.glDisable(GL.GL_DEPTH_TEST); + } } else { gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); } |