aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java10
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java7
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java9
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java31
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java10
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java8
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java3
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java126
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java17
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java25
24 files changed, 205 insertions, 180 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);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
index ac5258595..737589954 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
@@ -100,8 +100,7 @@ public final class Scene implements GLEventListener {
private GLAutoDrawable cDrawable = null;
private static RegionRenderer createRenderer() {
- final RenderState rs = RenderState.createRenderState(SVertex.factory());
- return RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ return RegionRenderer.create(SVertex.factory(), RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
}
/**
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index c8e9a0113..2ffa68be6 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -243,7 +243,7 @@ public abstract class GLRegion extends Region {
* The <i>alpha</i> component shall be set to zero.
* Note: If {@link GL#GL_BLEND blending} is enabled, the
* {@link RegionRenderer} might need to be
- * {@link RegionRenderer#create(RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) created}
+ * {@link RegionRenderer#create(Vertex.Factory<? extends Vertex>, RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) created}
* with the appropriate {@link RegionRenderer.GLCallback callbacks}.
* </p>
* @param matrix current {@link PMVMatrix}.
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 54deb9e4b..43a322a2d 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.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:
@@ -47,6 +47,8 @@ import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.geom.SVertex;
+import com.jogamp.graph.geom.Vertex;
/**
* OpenGL {@link Region} renderer
@@ -60,13 +62,13 @@ import com.jogamp.graph.curve.Region;
* At its {@link #destroy(GL2ES2) destruction}, all {@link ShaderProgram}s and its {@link RenderState}
* will be destroyed and released.
*/
-public class RegionRenderer {
+public final class RegionRenderer {
protected static final boolean DEBUG = Region.DEBUG;
protected static final boolean DEBUG_INSTANCE = Region.DEBUG_INSTANCE;
/**
* May be passed to
- * {@link RegionRenderer#create(RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) RegionRenderer ctor},
+ * {@link RegionRenderer#create(Vertex.Factory<? extends Vertex>, RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) RegionRenderer ctor},
* e.g.
* <ul>
* <li>{@link RegionRenderer#defaultBlendEnable}</li>
@@ -91,7 +93,7 @@ public class RegionRenderer {
* to set the proper {@link GL#glBlendFuncSeparate(int, int, int, int) blend-function}
* and the clear-color to <i>transparent-black</i> in case of {@link Region#isTwoPass(int) multipass} FBO rendering.
* </p>
- * @see #create(RenderState, GLCallback, GLCallback)
+ * @see #create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback)
* @see #enable(GL2ES2, boolean)
*/
public static final GLCallback defaultBlendEnable = new GLCallback() {
@@ -115,7 +117,7 @@ public class RegionRenderer {
* <p>
* Implementation also clears {@link RegionRenderer#getRenderState() RenderState}'s {@link RenderState#BITHINT_BLENDING_ENABLED blending bit-hint}.
* </p>
- * @see #create(RenderState, GLCallback, GLCallback)
+ * @see #create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback)
* @see #enable(GL2ES2, boolean)
*/
public static final GLCallback defaultBlendDisable = new GLCallback() {
@@ -131,15 +133,55 @@ public class RegionRenderer {
}
};
+ public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory, final RenderState rs,
+ final GLCallback enableCallback, final GLCallback disableCallback) {
+ return null;
+ }
+
+ /**
+ * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition.
+ * <p>
+ * The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code>
+ * maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/>
+ * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
+ * can be utilized to enable and disable {@link GL#GL_BLEND}.
+ * </p>
+ * @return an instance of Region Renderer
+ * @see #enable(GL2ES2, boolean)
+ */
+ public static RegionRenderer create() {
+ return new RegionRenderer(null, null, null);
+ }
+
+ /**
+ * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition.
+ * <p>
+ * The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code>
+ * maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/>
+ * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
+ * can be utilized to enable and disable {@link GL#GL_BLEND}.
+ * </p>
+ * @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
+ * {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}.
+ * @param disableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
+ * {@link #enable(GL2ES2, boolean) enable(gl, false)}.
+ * @return an instance of Region Renderer
+ * @see #enable(GL2ES2, boolean)
+ */
+ public static RegionRenderer create(final GLCallback enableCallback, final GLCallback disableCallback) {
+ return new RegionRenderer(null, enableCallback, disableCallback);
+ }
+
/**
- * Create a Hardware accelerated Region Renderer.
+ * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition.
* <p>
* The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code>
* maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/>
* For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
* can be utilized to enable and disable {@link GL#GL_BLEND}.
* </p>
- * @param rs the used {@link RenderState}
+ * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition,
+ * If null, SVertex.factory() will be used.
* @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
* {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}.
* @param disableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
@@ -147,9 +189,32 @@ public class RegionRenderer {
* @return an instance of Region Renderer
* @see #enable(GL2ES2, boolean)
*/
- public static RegionRenderer create(final RenderState rs, final GLCallback enableCallback,
- final GLCallback disableCallback) {
- return new RegionRenderer(rs, enableCallback, disableCallback);
+ public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory,
+ final GLCallback enableCallback, final GLCallback disableCallback) {
+ return new RegionRenderer(pointFactory, enableCallback, disableCallback);
+ }
+
+ /**
+ * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition.
+ * <p>
+ * The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code>
+ * maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/>
+ * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable}
+ * can be utilized to enable and disable {@link GL#GL_BLEND}.
+ * </p>
+ * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition.
+ * If null, SVertex.factory() will be used.
+ * @param sharedPMVMatrix optional shared {@link PMVMatrix} to be used for the {@link RenderState} composition.
+ * @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
+ * {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}.
+ * @param disableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at
+ * {@link #enable(GL2ES2, boolean) enable(gl, false)}.
+ * @return an instance of Region Renderer
+ * @see #enable(GL2ES2, boolean)
+ */
+ public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix,
+ final GLCallback enableCallback, final GLCallback disableCallback) {
+ return new RegionRenderer(pointFactory, sharedPMVMatrix, enableCallback, disableCallback);
}
private final RenderState rs;
@@ -177,15 +242,23 @@ public class RegionRenderer {
/** Return height of current viewport */
public final int getHeight() { return viewport[3]; }
+ /** Borrow the current {@link PMVMatrix}. */
public final PMVMatrix getMatrix() { return rs.getMatrix(); }
//////////////////////////////////////
- /**
- * @param rs the used {@link RenderState}
- */
- protected RegionRenderer(final RenderState rs, final GLCallback enableCallback, final GLCallback disableCallback) {
- this.rs = rs;
+ protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory,
+ final GLCallback enableCallback, final GLCallback disableCallback)
+ {
+ this.rs = new RenderState(pointFactory, null);
+ this.enableCallback = enableCallback;
+ this.disableCallback = disableCallback;
+ }
+
+ protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix,
+ final GLCallback enableCallback, final GLCallback disableCallback)
+ {
+ this.rs = new RenderState(pointFactory, sharedPMVMatrix);
this.enableCallback = enableCallback;
this.disableCallback = disableCallback;
}
@@ -245,16 +318,25 @@ public class RegionRenderer {
initialized = false;
}
+ /** Return the {@link RenderState} composition. */
public final RenderState getRenderState() { return rs; }
/**
* Enabling or disabling the {@link #getRenderState() RenderState}'s
- * {@link RenderState#getShaderProgram() shader program}.
+ * current {@link RenderState#getShaderProgram() shader program}.
+ * <p>
+ * {@link #useShaderProgram(GL2ES2, int, boolean, int, int, TextureSequence)}
+ * generates, selects and caches the desired Curve-Graph {@link ShaderProgram}
+ * and {@link RenderState#setShaderProgram(GL2ES2, ShaderProgram) sets it current} in the {@link RenderState} composition.
+ * </p>
* <p>
- * In case enable and disable {@link GLCallback}s are setup via {@link #create(RenderState, GLCallback, GLCallback)},
+ * In case enable and disable {@link GLCallback}s are setup via {@link #create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback)},
* they will be called before toggling the shader program.
* </p>
- * @see #create(RenderState, GLCallback, GLCallback)
+ * @see #create(Vertex.Factory<? extends Vertex>, RenderState, GLCallback, GLCallback)
+ * @see #useShaderProgram(GL2ES2, int, boolean, int, int, TextureSequence)
+ * @see RenderState#setShaderProgram(GL2ES2, ShaderProgram)
+ * @see RenderState#getShaderProgram()
*/
public final void enable(final GL2ES2 gl, final boolean enable) {
if( enable ) {
@@ -420,6 +502,11 @@ public class RegionRenderer {
private static final int TWO_PASS_BIT = 1 << 31;
/**
+ * Generate, selects and caches the desired Curve-Graph {@link ShaderProgram} according to the given parameters.
+ *
+ * The newly generated or cached {@link ShaderProgram} is {@link RenderState#setShaderProgram(GL2ES2, ShaderProgram) set current} in the {@link RenderState} composition
+ * and can be retrieved via {@link RenderState#getShaderProgram()}.
+ *
* @param gl
* @param renderModes
* @param pass1
@@ -428,6 +515,9 @@ public class RegionRenderer {
* @param colorTexSeq
* @return true if a new shader program is being used and hence external uniform-data and -location,
* as well as the attribute-location must be updated, otherwise false.
+ * @see #enable(GL2ES2, boolean)
+ * @see RenderState#setShaderProgram(GL2ES2, ShaderProgram)
+ * @see RenderState#getShaderProgram()
*/
public final boolean useShaderProgram(final GL2ES2 gl, final int renderModes,
final boolean pass1, final int quality, final int sampleCount, final TextureSequence colorTexSeq) {
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 3f7e3f81d..09486874d 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011 JogAmp Community. All rights reserved.
+ * Copyright 2011-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,8 +37,8 @@ import com.jogamp.opengl.GLUniformData;
import jogamp.common.os.PlatformPropsImpl;
import jogamp.graph.curve.opengl.shader.UniformNames;
-import com.jogamp.common.os.Platform;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.geom.SVertex;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
@@ -82,14 +82,6 @@ public class RenderState {
*/
public static final int BITHINT_GLOBAL_DEPTH_TEST_ENABLED = 1 << 1 ;
- public static RenderState createRenderState(final Vertex.Factory<? extends Vertex> pointFactory) {
- return new RenderState(pointFactory, null);
- }
-
- public static RenderState createRenderState(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix pmvMatrix) {
- return new RenderState(pointFactory, pmvMatrix);
- }
-
public static final RenderState getRenderState(final GL2ES2 gl) {
return (RenderState) gl.getContext().getAttachedObject(thisKey);
}
@@ -186,11 +178,16 @@ public class RenderState {
}
}
- protected RenderState(final Vertex.Factory<? extends Vertex> vertexFactory, final PMVMatrix pmvMatrix) {
+ /**
+ * Create a RenderState, a composition of RegionRenderer
+ * @param vertexFactory used Vertex.Factory, if null SVertex.factory() will be used.
+ * @param sharedPMVMatrix optional shared PMVMatrix, if null using a local instance
+ */
+ /* pp */ RenderState(final Vertex.Factory<? extends Vertex> vertexFactory, final PMVMatrix sharedPMVMatrix) {
this.id = getNextID();
this.sp = null;
- this.vertexFactory = vertexFactory;
- this.pmvMatrix = null != pmvMatrix ? pmvMatrix : new PMVMatrix();
+ this.vertexFactory = null != vertexFactory ? vertexFactory : SVertex.factory();
+ this.pmvMatrix = null != sharedPMVMatrix ? sharedPMVMatrix : new PMVMatrix();
this.weight = new float[1];
this.weightBuffer = FloatBuffer.wrap(weight);
this.colorStatic = new float[4];
@@ -337,7 +334,7 @@ public class RenderState {
/**
* Only nullifies {@link ShaderProgram} reference owned by {@link RegionRenderer}.
*/
- public void destroy(final GL2ES2 gl) {
+ /* pp */ void destroy() {
sp = null; // owned by RegionRenderer
}
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();