From e16e974a3e2b38c65355838eeb010954354097d2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 14 Mar 2014 08:13:42 +0100 Subject: Bug 801: Add Frustum support to Region; Misc .. Region: Add Frustum support, to drop 'out of sight' shapes RenderState: Add hints, e.g. BITHINT_BLENDING_ENABLED, allowing user code to toggle background color etc Demos: Incomplete - WIP - Reuse mapped object to window coords computed at reshape - TODO: Use minimal Scenegraph for Graph-UI .. --- .../com/jogamp/graph/curve/opengl/RegionRenderer.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java') 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 1f6e532d3..bff7c905f 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -62,27 +62,35 @@ public abstract class RegionRenderer { * Default {@link GL#GL_BLEND} enable {@link GLCallback}, * turning on the {@link GL#GL_BLEND} state and setting up * {@link GL#glBlendFunc(int, int) glBlendFunc}({@link GL#GL_SRC_ALPHA}, {@link GL#GL_ONE_MINUS_SRC_ALPHA}). - * @see #setEnableCallback(GLCallback, GLCallback) + *

+ * Implementation also sets {@link RegionRenderer#getRenderState() RenderState}'s {@link RenderState#BITHINT_BLENDING_ENABLED blending bit-hint}. + *

+ * @see #create(RenderState, int, GLCallback, GLCallback) * @see #enable(GL2ES2, boolean) */ public static final GLCallback defaultBlendEnable = new GLCallback() { @Override - public void run(final GL gl, final RegionRenderer args) { + public void run(final GL gl, final RegionRenderer renderer) { gl.glEnable(GL.GL_BLEND); gl.glBlendEquation(GL.GL_FUNC_ADD); // default gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); + renderer.rs.setHintBits(RenderState.BITHINT_BLENDING_ENABLED); } }; /** * Default {@link GL#GL_BLEND} disable {@link GLCallback}, * simply turning off the {@link GL#GL_BLEND} state. - * @see #setEnableCallback(GLCallback, GLCallback) + *

+ * Implementation also clears {@link RegionRenderer#getRenderState() RenderState}'s {@link RenderState#BITHINT_BLENDING_ENABLED blending bit-hint}. + *

+ * @see #create(RenderState, int, GLCallback, GLCallback) * @see #enable(GL2ES2, boolean) */ public static final GLCallback defaultBlendDisable = new GLCallback() { @Override - public void run(final GL gl, final RegionRenderer args) { + public void run(final GL gl, final RegionRenderer renderer) { + renderer.rs.clearHintBits(RenderState.BITHINT_BLENDING_ENABLED); gl.glDisable(GL.GL_BLEND); } }; @@ -287,7 +295,7 @@ public abstract class RegionRenderer { } - public final void getColorStatic(GL2ES2 gl, float[] rgb) { + public final void getColorStatic(float[] rgb) { FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer(); rgb[0] = fb.get(0); rgb[1] = fb.get(1); -- cgit v1.2.3