From c21082a5d7caf0ae6e29144358b4b4a1eafec019 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 20 Apr 2023 21:48:15 +0200 Subject: Graph GLRegion/TextRegionUtil: Enhance pre-determination of buffer-size, increase default initial 16->64 (unsued) - Region.countOutlineShape(..) now returns unpatched 3*triangle value for indices, avoiding grow - TextRegionUtil.addStringToRegion() uses countStringRegion(..) per default - Added GLRegion.create(.., OutlineShape) for convenience, using Region.countOutlineShape(..) - Refined API doc - --- .../com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java | 2 +- .../com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java | 5 ++++- .../opengl/test/junit/graph/GPUTextRendererListenerBase01.java | 6 +++--- .../com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java | 4 ++-- .../com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/test') 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 fd4ec47b1..0b25b3d3a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java @@ -272,7 +272,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { createTestOutline01(); break; } - region = GLRegion.create(gl.getGLProfile(), getRenderModes(), null); + region = GLRegion.create(gl.getGLProfile(), getRenderModes(), null, outlineShape); region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new Vec4f()) : null); } 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 80beafd60..10cabb213 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java @@ -38,6 +38,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -73,6 +74,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { shape.addVertex(10.0f,0.0f, true); shape.addVertex(5.0f,0.0f, false); shape.closeLastOutline(true); + final int[/*2*/] vertIndexCount = Region.countOutlineShape(shape, new int[2]); /** Same shape as above but without any off-curve vertices */ shape = new OutlineShape(); @@ -92,8 +94,9 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { shape.addVertex(offset+10.0f,-5.0f, true); shape.addVertex(offset+10.0f,0.0f, true); shape.closeLastOutline(true); + Region.countOutlineShape(shape, vertIndexCount); - region = GLRegion.create(glp, getRenderModes(), null); + region = GLRegion.create(glp, getRenderModes(), null, vertIndexCount[0], vertIndexCount[1]); region.addOutlineShapes(outlineShapes, null, null); } 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 8a7cd0e1b..f4283bf41 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java @@ -155,9 +155,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB renderModes, debug, trace); 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); - this.regionBottom = GLRegion.create(glp, renderModes, null); + this.regionFPS = GLRegion.create(glp, renderModes, null, 0, 0); + this.regionHead = GLRegion.create(glp, renderModes, null, 0, 0); + this.regionBottom = GLRegion.create(glp, renderModes, null, 0, 0); setFontSet(fontSet, FontSet.FAMILY_LIGHT, FontSet.STYLE_NONE); setMatrix(0, 0, 0, 0f, sampleCount); } 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 6a666cf21..23da67b3c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -295,8 +295,8 @@ public class TestTextRendererNEWT10 extends UITestCase { super(renderModes, new int[] { sampleCount }); setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - regionFPS = GLRegion.create(glp, renderModes, null); - regionFPSAnim = GLRegion.create(glp, renderModes, null); + regionFPS = GLRegion.create(glp, renderModes, null, 0, 0); + regionFPSAnim = GLRegion.create(glp, renderModes, null, 0, 0); if( null != fontURL ) { Font _font = null; try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java index c8ce8b1c2..935a02dd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java @@ -76,7 +76,7 @@ public abstract class GLReadBuffer00Base extends UITestCase { // FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO super(Region.VBAA_RENDERING_BIT, new int[] { 4 }); this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); - regionFPS = GLRegion.create(glp, renderModes, null); + regionFPS = GLRegion.create(glp, renderModes, null, 0, 0); staticRGBAColor[0] = 0.9f; staticRGBAColor[1] = 0.9f; -- cgit v1.2.3