diff options
author | Sven Gothel <[email protected]> | 2014-03-14 08:13:42 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-14 08:13:42 +0100 |
commit | e16e974a3e2b38c65355838eeb010954354097d2 (patch) | |
tree | e1582436012d80ffddb5a81e6056a5aaa4e7368b /src/jogl/classes/jogamp/graph/curve/opengl | |
parent | 70979247aad156418c32959bbf4962f175191ec2 (diff) |
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 ..
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
3 files changed, 46 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index 176b39c25..4aeceea7e 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -111,7 +111,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { } @Override - protected void update(final GL2ES2 gl, final RegionRenderer renderer) { + protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) { if(null == indicesFbo) { final ShaderState st = renderer.getShaderState(); @@ -137,7 +137,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { st.ownAttribute(texCoordTxtAttr, true); if(Region.DEBUG_INSTANCE) { - System.err.println("VBORegion2PES2 Create: " + this); + System.err.println("VBORegion2PMSAAES2 Create: " + this); } } // seal buffers @@ -178,6 +178,18 @@ public class VBORegion2PMSAAES2 extends GLRegion { @Override protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) { + if( 0 >= indicesTxtBuffer.getElementCount() ) { + if(DEBUG_INSTANCE) { + System.err.printf("VBORegion2PMSAAES2.drawImpl: Empty%n"); + } + return; // empty! + } + if( Float.isInfinite(box.getWidth()) || Float.isInfinite(box.getHeight()) ) { + if(DEBUG_INSTANCE) { + System.err.printf("VBORegion2PMSAAES2.drawImpl: Inf %s%n", box); + } + return; // inf + } final int width = renderer.getWidth(); final int height = renderer.getHeight(); if(width <=0 || height <= 0 || null==sampleCount || sampleCount[0] <= 0){ @@ -209,6 +221,10 @@ public class VBORegion2PMSAAES2 extends GLRegion { diffWidth, diffHeight, sampleCount[0]); } } + if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { + // Nothing .. + return; + } final int deltaFboWidth = Math.abs(targetFboWidth-fboWidth); final int deltaFboHeight = Math.abs(targetFboHeight-fboHeight); final int maxDeltaFbo, maxLengthFbo; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 3f3709d6e..a760dcd33 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -112,7 +112,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { } @Override - protected void update(final GL2ES2 gl, final RegionRenderer renderer) { + protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) { if(null == indicesFbo) { final ShaderState st = renderer.getShaderState(); @@ -138,7 +138,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { st.ownAttribute(texCoordTxtAttr, true); if(Region.DEBUG_INSTANCE) { - System.err.println("VBORegion2PES2 Create: " + this); + System.err.println("VBORegion2PVBAAES2 Create: " + this); } } // seal buffers @@ -179,6 +179,18 @@ public class VBORegion2PVBAAES2 extends GLRegion { @Override protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) { + if( 0 >= indicesTxtBuffer.getElementCount() ) { + if(DEBUG_INSTANCE) { + System.err.printf("VBORegion2PVBAAES2.drawImpl: Empty%n"); + } + return; // empty! + } + if( Float.isInfinite(box.getWidth()) || Float.isInfinite(box.getHeight()) ) { + if(DEBUG_INSTANCE) { + System.err.printf("VBORegion2PVBAAES2.drawImpl: Inf %s%n", box); + } + return; // inf + } final int width = renderer.getWidth(); final int height = renderer.getHeight(); if(width <=0 || height <= 0 || null==sampleCount || sampleCount[0] <= 0){ @@ -207,13 +219,19 @@ public class VBORegion2PVBAAES2 extends GLRegion { targetFboWidth = (int)Math.ceil(renderFboWidth); targetFboHeight = (int)Math.ceil(renderFboHeight); if( DEBUG_FBO_2 ) { - System.err.printf("XXX.MinMax1 view[%d, %d] -> win[%.3f, %.3f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], msaa %d%n", + System.err.printf("XXX.MinMax obj %s%n", box.toString()); + System.err.printf("XXX.MinMax win %s%n", drawWinBox.toString()); + System.err.printf("XXX.MinMax view[%d, %d] -> win[%.3f, %.3f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], msaa %d%n", drawView[2], drawView[3], winWidth, winHeight, renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight, diffWidth, diffHeight, sampleCount[0]); } } + if( 0 >= targetFboWidth || 0 >= targetFboHeight ) { + // Nothing .. + return; + } final int deltaFboWidth = Math.abs(targetFboWidth-fboWidth); final int deltaFboHeight = Math.abs(targetFboHeight-fboHeight); final int maxDeltaFbo, maxLengthFbo; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index bdf824b6a..e45e623ba 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -81,7 +81,7 @@ public class VBORegionSPES2 extends GLRegion { } @Override - protected void update(final GL2ES2 gl, final RegionRenderer renderer) { + protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) { if( !buffersAttached ) { final ShaderState st = renderer.getShaderState(); st.ownAttribute(verticeAttr, true); @@ -104,6 +104,12 @@ public class VBORegionSPES2 extends GLRegion { @Override protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) { + if( 0 >= indicesBuffer.getElementCount() ) { + if(DEBUG_INSTANCE) { + System.err.printf("VBORegionSPES2.drawImpl: Empty%n"); + } + return; // empty! + } verticeAttr.enableBuffer(gl, true); texCoordAttr.enableBuffer(gl, true); indicesBuffer.bindBuffer(gl, true); // keeps VBO binding |