diff options
Diffstat (limited to 'src/demos/com/jogamp')
8 files changed, 39 insertions, 41 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java index 1ec894d15..866d6623d 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java @@ -52,7 +52,7 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { public GPURegionGLListener00 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); - this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } @@ -92,7 +92,7 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { outlineShape.closeLastOutline(true); region = GLRegion.create(glp, getRenderModes(), null, outlineShape); - region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new Vec4f()) : null); + region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getColorStatic(new Vec4f()) : null); } @Override @@ -101,12 +101,10 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - final RenderState rs = getRenderer().getRenderState(); - gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_BLEND); - rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); + getRenderer().setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); createTestOutline(gl.getGLProfile()); } @@ -124,8 +122,8 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { pmv.glLoadIdentity(); pmv.glTranslatef(getXTran(), getYTran(), getZTran()); pmv.glRotatef(getAngle(), 0, 1, 0); - if( weight != regionRenderer.getRenderState().getWeight() ) { - regionRenderer.getRenderState().setWeight(weight); + if( weight != regionRenderer.getWeight() ) { + regionRenderer.setWeight(weight); } regionRenderer.enable(gl, true); region.draw(gl, regionRenderer, getSampleCount()); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java index fd1ba4df3..e5699a2d6 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java @@ -59,7 +59,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { public GPURegionGLListener01 (final int shape_ctor_mode, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); this.shape_ctor_mode = shape_ctor_mode; - this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } @@ -247,12 +247,10 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - final RenderState rs = getRenderer().getRenderState(); - gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_BLEND); - rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); + getRenderer().setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); outlineShape = new OutlineShape(); switch( shape_ctor_mode ) { @@ -273,7 +271,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { break; } region = GLRegion.create(gl.getGLProfile(), getRenderModes(), null, outlineShape); - region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new Vec4f()) : null); + region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getColorStatic(new Vec4f()) : null); } @Override @@ -289,8 +287,8 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { pmv.glLoadIdentity(); pmv.glTranslatef(getXTran(), getYTran(), getZTran()); pmv.glRotatef(getAngle(), 0, 1, 0); - if( weight != regionRenderer.getRenderState().getWeight() ) { - regionRenderer.getRenderState().setWeight(weight); + if( weight != regionRenderer.getWeight() ) { + regionRenderer.setWeight(weight); } regionRenderer.enable(gl, true); region.draw(gl, regionRenderer, getSampleCount()); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java index f23d15b24..42b42a719 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java @@ -53,7 +53,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { public GPURegionGLListener10 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); - this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } @@ -106,12 +106,10 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - final RenderState rs = getRenderer().getRenderState(); - gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_BLEND); - rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); + getRenderer().setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); createTestOutline(gl.getGLProfile()); } @@ -130,8 +128,8 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { pmv.glLoadIdentity(); pmv.glTranslatef(getXTran(), getYTran(), getZTran()); pmv.glRotatef(getAngle(), 0, 1, 0); - if( weight != regionRenderer.getRenderState().getWeight() ) { - regionRenderer.getRenderState().setWeight(weight); + if( weight != regionRenderer.getWeight() ) { + regionRenderer.setWeight(weight); } regionRenderer.enable(gl, true); region.draw(gl, regionRenderer, getSampleCount()); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java index 0fd982cd6..1f6be695c 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java @@ -51,12 +51,10 @@ public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - final RenderState rs = getRenderer().getRenderState(); - gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_BLEND); - rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); + getRenderer().setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java index 26feafa5a..a5fac1270 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java @@ -154,7 +154,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB // NOTE_ALPHA_BLENDING: We use alpha-blending super(RegionRenderer.create(blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null), renderModes, debug, trace); - this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRegionUtil = new TextRegionUtil(renderModes); this.regionFPS = GLRegion.create(glp, renderModes, null, 0, 0); this.regionHead = GLRegion.create(glp, renderModes, null, 0, 0); @@ -302,11 +302,10 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB // final int[] view = new int[] { 0, 0, drawable.getWidth(), drawable.getHeight() }; final RegionRenderer renderer = getRenderer(); - final RenderState rs = renderer.getRenderState(); final PMVMatrix pmv = renderer.getMatrix(); pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); - rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); + renderer.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); final float pixelSizeFName = FontScale.toPixels(fontSizeFName, dpiV); final float pixelSizeHead = FontScale.toPixels(fontSizeHead, dpiV); final float mmSizeHead = pixelSizeHead / ppmmV; @@ -333,7 +332,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB fontSizeHead, pixelSizeHead, mmSizeHead, fontSizeCenter, pixelSizeCenter, mmSizeCenter, modeS, getSampleCount()[0], sampleCountFPS[0], - renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED), + renderer.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED), drawable.getChosenGLCapabilities().getAlphaBits()); // bottom, half line up @@ -390,7 +389,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB final float sxy = nearPlaneS * pixelSizeCenter; pmv.glScalef(sxy, sxy, 1.0f); } - rs.setColorStatic(0.9f, 0.0f, 0.0f, 1.0f); + renderer.setColorStatic(0.9f, 0.0f, 0.0f, 1.0f); if( bottomTextUseFrustum ) { regionBottom.setFrustum(pmv.getFrustum()); diff --git a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java index 3e6cec83e..438457993 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java +++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java @@ -132,11 +132,11 @@ public abstract class TextRendererGLELBase implements GLEventListener { public void init(final GLAutoDrawable drawable) { exclusivePMVMatrix = null == sharedPMVMatrix; renderer = RegionRenderer.create(sharedPMVMatrix, enableCallback, disableCallback); - renderer.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + renderer.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRenderUtil = new TextRegionUtil(renderModes); final GL2ES2 gl = drawable.getGL().getGL2ES2(); renderer.init(gl); - renderer.getRenderState().setColorStatic(staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2], staticRGBAColor[3]); + renderer.setColorStatic(staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2], staticRGBAColor[3]); final Object upObj = drawable.getUpstreamWidget(); if( upObj instanceof Window ) { diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index 7fee8ef9b..436bab31a 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -313,7 +313,7 @@ public class UISceneDemo20 implements GLEventListener { } scene = new Scene(); scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); - scene.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + scene.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); // scene.setSampleCount(3); // easy on embedded devices w/ just 3 samples (default is 4)? scene.setDebugBorderBox(options.debugBoxThickness); scene.addShape(buttonsLeft); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java index 27bc34b58..dd4c0766c 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemoU01a.java @@ -92,10 +92,11 @@ import com.jogamp.opengl.util.PMVMatrix; */ public class UISceneDemoU01a { static final GraphUIDemoArgs options = new GraphUIDemoArgs(1432, 770, Region.VBAA_RENDERING_BIT | Region.COLORCHANNEL_RENDERING_BIT); - static final Vec4f fg_color = new Vec4f( 0, 0, 0, 1 ); + static final Vec4f text_color = new Vec4f( 0, 1, 0, 1 ); static Font font; static boolean projOrtho = true; static boolean projOrthoWin = false; + static boolean textOnly = false; static int pass2TexUnit = GLRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT; static final Vec2i winOrigin = new Vec2i(options.surface_width/2, options.surface_height/2); static final float normWidgetSize = 1/4f; @@ -121,6 +122,8 @@ public class UISceneDemoU01a { } else if(args[idx[0]].equals("-y")) { idx[0]++; winOrigin.setY( MiscUtils.atoi(args[idx[0]], winOrigin.y()) ); + } else if(args[idx[0]].equals("-textOnly")) { + textOnly = true; } } } @@ -207,11 +210,13 @@ public class UISceneDemoU01a { public void init(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - shape = new CrossHair(options.renderModes, normWidgetSize, normWidgetSize, normWidgetSize/100f); // normalized: 1 is 100% surface size (width and/or height) - shape.setTextureUnit(pass2TexUnit); - shape.setColor(0, 0, 1, 1); - System.err.println("Init: Shape bounds "+shape.getBounds(drawable.getGLProfile())); - System.err.println("Init: Shape "+shape); + if( !textOnly ) { + shape = new CrossHair(options.renderModes, normWidgetSize, normWidgetSize, normWidgetSize/100f); // normalized: 1 is 100% surface size (width and/or height) + shape.setTextureUnit(pass2TexUnit); + shape.setColor(0, 0, 1, 1); + System.err.println("Init: Shape bounds "+shape.getBounds(drawable.getGLProfile())); + System.err.println("Init: Shape "+shape); + } renderer.init(gl); @@ -226,7 +231,7 @@ public class UISceneDemoU01a { setMatrix(renderer.getMatrix(), renderer.getViewport()); // scale shapes from normalized size 1 and to keep aspect ratio - { + if( !textOnly ) { final float s = Math.min(worldDim.x(), worldDim.y()); shape.setScale(s, s, 1f); } @@ -306,7 +311,7 @@ public class UISceneDemoU01a { drawText(gl, pmv, "Hello JogAmp Users!"); pmv.glPopMatrix(); } - { + if( !textOnly ) { pmv.glPushMatrix(); shape.setTransform(pmv); @@ -336,7 +341,7 @@ public class UISceneDemoU01a { final float txt_scale = full_width_s < full_height_s ? full_width_s * normWidgetSize : full_height_s * normWidgetSize; pmv.glScalef(txt_scale, txt_scale, 1f); pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f); - final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, fg_color, sampleCount, tempT1, tempT2); + final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, sampleCount, tempT1, tempT2); if( onceAtDisplay ) { System.err.println("XXX: full_width: "+worldDim.x()+" / "+txt_box_em.getWidth()+" -> "+full_width_s); @@ -354,7 +359,9 @@ public class UISceneDemoU01a { public void dispose(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); textRegion.destroy(gl); - shape.destroy(gl, renderer); + if( !textOnly ) { + shape.destroy(gl, renderer); + } renderer.destroy(gl); System.err.println("Destroyed"); } |