diff options
Diffstat (limited to 'src/demos')
10 files changed, 40 insertions, 62 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java index 2515b8217..94dd0ff4d 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -50,9 +50,9 @@ import com.jogamp.opengl.util.PMVMatrix; public class GPURegionGLListener00 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionGLListener00 (final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - super(RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + public GPURegionGLListener00 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { + super(RegionRenderer.create(null, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); + this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java index c7fbe54c8..23e1e1b64 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java @@ -52,14 +52,14 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { final int shape_ctor_mode; OutlineShape outlineShape = null; - public GPURegionGLListener01 (final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - this(1, rs, renderModes, sampleCount, debug, trace); + public GPURegionGLListener01 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { + this(1, renderModes, sampleCount, debug, trace); } - public GPURegionGLListener01 (final int shape_ctor_mode, final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - super(RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); + 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; - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java index 6af1aac96..966f18972 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -50,9 +50,9 @@ import com.jogamp.opengl.util.PMVMatrix; public class GPURegionGLListener10 extends GPURendererListenerBase01 { List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>(); - public GPURegionGLListener10 (final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - super(RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + 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); setMatrix(-20, 00, -50, 0f, sampleCount); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java index 59292c7be..e65f74e57 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java @@ -131,8 +131,7 @@ public class GPURegionNewtDemo { window.setSize(width, height); window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rs, rmode, sampleCount, DEBUG, TRACE); + final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rmode, sampleCount, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setVisible(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java index 8a8a49869..0fd982cd6 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -32,15 +32,13 @@ import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLProfile; -import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.opengl.GLWindow; public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { - public GPUTextGLListener0A(final GLProfile glp, final RenderState rs, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { - super(glp, rs, renderModes, sampleCount, blending, debug, trace); + public GPUTextGLListener0A(final GLProfile glp, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { + super(glp, renderModes, sampleCount, blending, debug, trace); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java index b4e91e01f..3f60ef8a2 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -37,11 +37,9 @@ import java.io.IOException; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; -import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -142,8 +140,7 @@ public class GPUTextNewtDemo { window.setSize(width, height); window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rs, rmode, sampleCount, true, DEBUG, TRACE); + final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rmode, sampleCount, true, DEBUG, TRACE); textGLListener.setFont(opt_font); textGLListener.setFontHeadSize(opt_fontSizeHead); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java index 22e3664c1..0b506af72 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -149,12 +149,11 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB Window upstream_window = null; StringBuilder userString = new StringBuilder(textX1); boolean userInput = false; - public GPUTextRendererListenerBase01(final GLProfile glp, final RenderState rs, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { + public GPUTextRendererListenerBase01(final GLProfile glp, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { // NOTE_ALPHA_BLENDING: We use alpha-blending - super(RegionRenderer.create(rs, blending ? RegionRenderer.defaultBlendEnable : null, - blending ? RegionRenderer.defaultBlendDisable : null), + super(RegionRenderer.create(blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null), renderModes, debug, trace); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRegionUtil = new TextRegionUtil(renderModes); this.regionFPS = GLRegion.create(glp, renderModes, null); this.regionHead = GLRegion.create(glp, renderModes, null); diff --git a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java index 7fc1d4dd2..43840af97 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java +++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2014 JogAmp Community. All rights reserved. + * Copyright 2014-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -42,7 +42,6 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.newt.Window; import com.jogamp.opengl.util.PMVMatrix; @@ -55,7 +54,6 @@ public abstract class TextRendererGLELBase implements GLEventListener { private boolean exclusivePMVMatrix = true; private PMVMatrix sharedPMVMatrix = null; - private RenderState rs = null; private RegionRenderer.GLCallback enableCallback=null, disableCallback=null; protected RegionRenderer renderer = null; protected TextRegionUtil textRenderUtil = null; @@ -97,14 +95,6 @@ public abstract class TextRendererGLELBase implements GLEventListener { } /** - * <p> - * Must be called before {@link #init(GLAutoDrawable)}. - * </p> - * @param rs - */ - public void setRenderState(final RenderState rs) { this.rs = rs; } - - /** * In exclusive mode, impl. uses a pixelScale of 1f and orthogonal PMV on window dimensions * and renderString uses 'height' for '1'. * <p> @@ -120,7 +110,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { } /** - * See {@link RegionRenderer#create(RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback)}. + * See {@link RegionRenderer#create(Vertex.Factory<? extends Vertex>, RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback)}. * <p> * Must be called before {@link #init(GLAutoDrawable)}. * </p> @@ -135,21 +125,18 @@ public abstract class TextRendererGLELBase implements GLEventListener { public final TextRegionUtil getTextRenderUtil() { return textRenderUtil; } public int[] getVBAASampleCount() { return this.vbaaSampleCount; } - public PMVMatrix getMatrix() { return rs.getMatrix(); }; + public PMVMatrix getMatrix() { return renderer.getMatrix(); }; public boolean isMatrixShared() { return !exclusivePMVMatrix; }; @Override public void init(final GLAutoDrawable drawable) { - if( null == this.rs ) { - exclusivePMVMatrix = null == sharedPMVMatrix; - this.rs = RenderState.createRenderState(SVertex.factory(), sharedPMVMatrix); - } - this.renderer = RegionRenderer.create(rs, enableCallback, disableCallback); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + exclusivePMVMatrix = null == sharedPMVMatrix; + this.renderer = RegionRenderer.create(null, sharedPMVMatrix, enableCallback, disableCallback); + this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRenderUtil = new TextRegionUtil(renderModes); final GL2ES2 gl = drawable.getGL().getGL2ES2(); renderer.init(gl); - rs.setColorStatic(staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2], staticRGBAColor[3]); + this.getRenderer().getRenderState().setColorStatic(staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2], staticRGBAColor[3]); renderer.enable(gl, false); final Object upObj = drawable.getUpstreamWidget(); @@ -263,7 +250,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { dx += sxy * font.getAdvanceWidth('X') * column; dy -= sxy * lineHeight * ( row + 1 ); - final PMVMatrix pmvMatrix = rs.getMatrix(); + final PMVMatrix pmvMatrix = getMatrix(); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); if( !exclusivePMVMatrix ) { pmvMatrix.glPushMatrix(); @@ -313,7 +300,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { dx += sxy * font.getAdvanceWidth('X') * column; dy -= sxy * lineHeight * ( row + 1 ); - final PMVMatrix pmvMatrix = rs.getMatrix(); + final PMVMatrix pmvMatrix = getMatrix(); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); if( !exclusivePMVMatrix ) { pmvMatrix.glPushMatrix(); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index 76615b2c7..a4230bcaa 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -48,7 +48,6 @@ import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; @@ -114,8 +113,9 @@ public class UIShapeDemo01 implements GLEventListener { // window.setPosition(10, 10); window.setSize(800, 400); window.setTitle(UIShapeDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final UIShapeDemo01 uiGLListener = new UIShapeDemo01(font, Region.COLORCHANNEL_RENDERING_BIT, rs, DEBUG, TRACE); + final int renderModes = Region.COLORCHANNEL_RENDERING_BIT | Region.VBAA_RENDERING_BIT; + // final int renderModes = Region.COLORCHANNEL_RENDERING_BIT; + final UIShapeDemo01 uiGLListener = new UIShapeDemo01(font, renderModes, DEBUG, TRACE); uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); window.setVisible(true); @@ -174,10 +174,10 @@ public class UIShapeDemo01 implements GLEventListener { protected final AffineTransform tempT1 = new AffineTransform(); protected final AffineTransform tempT2 = new AffineTransform(); - public UIShapeDemo01(final Font font, final int renderModes, final RenderState rs, final boolean debug, final boolean trace) { + public UIShapeDemo01(final Font font, final int renderModes, final boolean debug, final boolean trace) { this.font = font; this.renderModes = renderModes; - this.rRenderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + this.rRenderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); this.debug = debug; this.trace = trace; this.screenshot = new GLReadBufferUtil(false, false); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index 41235077e..7637a9942 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -53,7 +53,6 @@ import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; @@ -127,8 +126,7 @@ public class UITypeDemo01 implements GLEventListener { // window.setPosition(10, 10); window.setSize(800, 400); window.setTitle(UITypeDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final UITypeDemo01 uiGLListener = new UITypeDemo01(font, glyph_id, text, Region.COLORCHANNEL_RENDERING_BIT, rs, DEBUG, TRACE); + final UITypeDemo01 uiGLListener = new UITypeDemo01(font, glyph_id, text, Region.COLORCHANNEL_RENDERING_BIT, DEBUG, TRACE); uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); window.setVisible(true); @@ -191,12 +189,12 @@ public class UITypeDemo01 implements GLEventListener { protected final AffineTransform tempT2 = new AffineTransform(); @SuppressWarnings("unused") - public UITypeDemo01(final Font font, final int glyph_id, final String text, final int renderModes, final RenderState rs, final boolean debug, final boolean trace) { + public UITypeDemo01(final Font font, final int glyph_id, final String text, final int renderModes, final boolean debug, final boolean trace) { this.font = font; this.text = text; this.glyph_id = glyph_id; this.renderModes = renderModes; - this.rRenderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + this.rRenderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); this.debug = debug; this.trace = trace; this.screenshot = new GLReadBufferUtil(false, false); |