diff options
author | Sven Gothel <[email protected]> | 2023-03-15 03:37:44 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-15 03:37:44 +0100 |
commit | f8584748e33aab56780eca5cf7009a5a0d11991d (patch) | |
tree | 607524acb482e80dad20a3a5b00e0a2e76179d34 /src/test | |
parent | b3fe96b2916eb0359412aa8e57a9b1a9577f247d (diff) |
Graph: Make RenderState a composition of RegionRenderer, which also creates and destroys it. Dropping this also from user (complexity).
Diffstat (limited to 'src/test')
10 files changed, 44 insertions, 83 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java index e192cd2b9..688174772 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/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/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java index 4cfd61777..f285f8bd8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java +++ b/src/test/com/jogamp/opengl/test/junit/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/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java index 8f813d537..ccec9b982 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/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); @@ -318,16 +317,14 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB if( drawFPS ) { pmv.glPushMatrix(); final float pixelSizeFPS = FontScale.toPixels(fontSizeFPS, dpiV); - final float lfps, tfps, td; + final float lfps, tfps; final GLAnimatorControl animator = drawable.getAnimator(); if( null != animator ) { lfps = animator.getLastFPS(); tfps = animator.getTotalFPS(); - td = animator.getTotalFPSDuration()/1000f; } else { lfps = 0f; tfps = 0f; - td = 0f; } final String modeS = Region.getRenderModeString(regionFPS.getRenderModes()); final String text = String.format("%03.1f/%03.1f fps, v-sync %d, dpiV %.2f %.2f px/mm, font[head %.1fpt %.2fpx %.2fmm, center %.1fpt %.2fpx %.2fmm], %s-samples[%d, this %d], blend %b, alpha %d", diff --git a/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java index 1b6109af7..4d4d31027 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java @@ -54,7 +54,6 @@ import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.test.junit.util.MiscUtils; @@ -241,9 +240,8 @@ public class PerfTextRendererNEWT00 { final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final RegionRenderer renderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + final RegionRenderer renderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + renderer.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, font, text); System.err.println("Region post ctor w/ pre-calculated buffer size"); @@ -269,7 +267,7 @@ public class PerfTextRendererNEWT00 { // region.growBufferSize(123000, 62000); // hack-me gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); renderer.init(gl); - rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); + renderer.getRenderState().setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); // reshape gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index 3ffd22fd0..c19cec993 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -45,8 +45,6 @@ import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; 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; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -86,9 +84,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4); final GLWindow window = createWindow("t00-shape-vbaa0-msaa0", caps, 800, 400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -120,9 +117,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4); final GLWindow window = createWindow("t01-shape-vbaa0-msaa0", caps, 800, 400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -151,9 +147,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setNumSamples(4); final GLWindow window = createWindow("t10-shape-vbaa0-msaa1", caps, 800, 400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -187,9 +182,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setNumSamples(4); final GLWindow window = createWindow("t11-shape-vbaa0-msaa1", caps, 800, 400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); @@ -222,8 +216,7 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4); final GLWindow window = createWindow("t20-shape-vbaa1-msaa0", caps, 800,400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (rs, Region.VBAA_RENDERING_BIT, 4, false, false); + final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (Region.VBAA_RENDERING_BIT, 4, false, false); demo02Listener.attachInputListenerTo(window); window.addGLEventListener(demo02Listener); @@ -244,9 +237,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { private void test30RegionRendererShapesImpl(final GLCapabilities caps, final int shape_ctor_mode) throws InterruptedException { final GLWindow window = createWindow("t30-shape0"+shape_ctor_mode+"-vbaa0-msaa1", caps, 800, 400); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, rs, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, 0, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index c1a1725b8..3416958e3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -54,7 +54,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.opengl.math.geom.AABBox; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.NEWTGLContext; @@ -179,15 +178,14 @@ public class TestTextRendererNEWT01 extends UITestCase { System.err.println("Chosen: "+winctx.window.getChosenCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final RegionRenderer renderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + final RegionRenderer renderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + renderer.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); final TextRegionUtil textRenderUtil = new TextRegionUtil(renderModes); // init gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); renderer.init(gl); - rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); + renderer.getRenderState().setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); screenshot = new GLReadBufferUtil(false, false); // reshape diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 2a6c73a18..6a666cf21 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -51,11 +51,9 @@ import com.jogamp.common.os.Platform; 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.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; -import com.jogamp.graph.geom.SVertex; import com.jogamp.junit.util.JunitTracer; import com.jogamp.newt.Window; import com.jogamp.newt.opengl.GLWindow; @@ -233,7 +231,6 @@ public class TestTextRendererNEWT10 extends UITestCase { JunitTracer.waitForKey("Start"); } - final RenderState rs = RenderState.createRenderState(SVertex.factory()); final int renderModes, sampleCount; if( graphVBAASamples > 0 ) { renderModes = Region.VBAA_RENDERING_BIT; @@ -245,7 +242,7 @@ public class TestTextRendererNEWT10 extends UITestCase { renderModes = 0; sampleCount = 0; } - final TextRendererGLEL textGLListener = new TextRendererGLEL(glp, rs, renderModes, sampleCount); + final TextRendererGLEL textGLListener = new TextRendererGLEL(glp, renderModes, sampleCount); System.err.println(textGLListener.getFontInfo()); window.addGLEventListener(textGLListener); @@ -294,10 +291,9 @@ public class TestTextRendererNEWT10 extends UITestCase { float fontSizeAnim, fontSizeDelta; float dpiV, ppmmV; - TextRendererGLEL(final GLProfile glp, final RenderState rs, final int renderModes, final int sampleCount) { + TextRendererGLEL(final GLProfile glp, final int renderModes, final int sampleCount) { super(renderModes, new int[] { sampleCount }); setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - setRenderState(rs); regionFPS = GLRegion.create(glp, renderModes, null); regionFPSAnim = GLRegion.create(glp, renderModes, null); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java index 562688bdc..f30ff4b66 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java @@ -51,7 +51,6 @@ 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.geom.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.caps.NonFSAAGLCapsChooser; @@ -144,8 +143,7 @@ public class TestTextRendererNEWT20 extends UITestCase { // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString()); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final TextGLListener textGLListener = new TextGLListener(glp, rs, Region.VBAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.VBAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -198,8 +196,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final TextGLListener textGLListener = new TextGLListener(glp, rs, Region.MSAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, Region.MSAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -248,8 +245,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final TextGLListener textGLListener = new TextGLListener(glp, rs, 0, 0 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -295,8 +291,7 @@ public class TestTextRendererNEWT20 extends UITestCase { window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final TextGLListener textGLListener = new TextGLListener(glp, rs, 0, 0 /* sampleCount */, DEBUG, TRACE); + final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); textGLListener.setHeadBox(2, true); @@ -332,8 +327,8 @@ public class TestTextRendererNEWT20 extends UITestCase { } private static class TextGLListener extends GPUTextRendererListenerBase01 { - public TextGLListener(final GLProfile glp, final RenderState rs, final int type, final int sampleCount, final boolean debug, final boolean trace) { - super(glp, rs, type, sampleCount, true, debug, trace); + public TextGLListener(final GLProfile glp, final int type, final int sampleCount, final boolean debug, final boolean trace) { + super(glp, type, sampleCount, true, debug, trace); } @Override diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java index 74cc5ccb8..3917f7c1b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 JogAmp Community. All rights reserved. + * Copyright 2012-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: @@ -49,7 +49,6 @@ import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.SVertex; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.test.junit.util.NEWTGLContext; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -137,15 +136,14 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase { System.err.println("Chosen: "+winctx.window.getChosenCapabilities()); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - final RegionRenderer renderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); + final RegionRenderer renderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + renderer.getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); final TextRegionUtil textRenderUtil = new TextRegionUtil(renderModes); // init gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); renderer.init(gl); - rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); + renderer.getRenderState().setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); screenshot = new GLReadBufferUtil(false, false); // reshape diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java index 8c099e918..e208833a8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -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> @@ -136,16 +126,13 @@ public abstract class TextRendererGLELBase implements GLEventListener { @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(); @@ -259,7 +246,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 = renderer.getMatrix(); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); if( !exclusivePMVMatrix ) { pmvMatrix.glPushMatrix(); |