aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-04-10 00:31:52 +0200
committerSven Gothel <[email protected]>2014-04-10 00:31:52 +0200
commit45395696c252c215a8a22d05e5da7e98c662d07e (patch)
tree952c132450f7cc56aeed0bb1fc040bde5f3ba96a /src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
parent16324b8f8369379ab4db013c4785a496b25c7094 (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/com/jogamp/graph/curve/opengl/RegionRenderer.java')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index a0a318a49..272099385 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -69,7 +69,8 @@ public class RegionRenderer {
/**
* Default {@link GL#GL_BLEND} <i>enable</i> {@link GLCallback},
- * turning-off depth writing via {@link GL#glDepthMask(boolean)} and turning-on the {@link GL#GL_BLEND} state.
+ * turning-off depth writing via {@link GL#glDepthMask(boolean)} if {@link RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED} is set
+ * and turning-on the {@link GL#GL_BLEND} state.
* <p>
* Implementation also sets {@link RegionRenderer#getRenderState() RenderState}'s {@link RenderState#BITHINT_BLENDING_ENABLED blending bit-hint},
* which will cause {@link GLRegion#draw(GL2ES2, RegionRenderer, int[]) GLRegion's draw-method}
@@ -82,7 +83,11 @@ public class RegionRenderer {
public static final GLCallback defaultBlendEnable = new GLCallback() {
@Override
public void run(final GL gl, final RegionRenderer renderer) {
- gl.glDepthMask(false);
+ if( renderer.rs.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) {
+ gl.glDepthMask(false);
+ // gl.glDisable(GL.GL_DEPTH_TEST);
+ // gl.glDepthFunc(GL.GL_ALWAYS);
+ }
gl.glEnable(GL.GL_BLEND);
gl.glBlendEquation(GL.GL_FUNC_ADD); // default
renderer.rs.setHintMask(RenderState.BITHINT_BLENDING_ENABLED);
@@ -92,7 +97,7 @@ public class RegionRenderer {
/**
* Default {@link GL#GL_BLEND} <i>disable</i> {@link GLCallback},
* simply turning-off the {@link GL#GL_BLEND} state
- * and turning-on depth writing via {@link GL#glDepthMask(boolean)}.
+ * and turning-on depth writing via {@link GL#glDepthMask(boolean)} if {@link RenderState#BITHINT_GLOBAL_DEPTH_TEST_ENABLED} is set.
* <p>
* Implementation also clears {@link RegionRenderer#getRenderState() RenderState}'s {@link RenderState#BITHINT_BLENDING_ENABLED blending bit-hint}.
* </p>
@@ -104,7 +109,11 @@ public class RegionRenderer {
public void run(final GL gl, final RegionRenderer renderer) {
renderer.rs.clearHintMask(RenderState.BITHINT_BLENDING_ENABLED);
gl.glDisable(GL.GL_BLEND);
- gl.glDepthMask(true);
+ if( renderer.rs.isHintMaskSet(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED) ) {
+ // gl.glEnable(GL.GL_DEPTH_TEST);
+ // gl.glDepthFunc(GL.GL_LESS);
+ gl.glDepthMask(true);
+ }
}
};