aboutsummaryrefslogtreecommitdiffstats
path: root/src/demos/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-16 05:02:24 +0100
committerSven Göthel <[email protected]>2024-01-16 05:02:24 +0100
commit6b1979992a7da2573c420ce3eb22f35abcbd35b7 (patch)
tree5786a3286a773ccc3082977e1888c13b3f481dc9 /src/demos/com/jogamp/opengl
parent33ec9480da3d414a4c973607970afa06b5ed79ca (diff)
Graph/GraphUI AA-Quality + SampleCount (shader): Push params down to RegionRenderer's RenderState usually rarely set from top of user API, reducing complexity.
Discussion: Alternative was to pass AA-Quality same as SampleCount from the top (e.g. GraphUI Scene), however, this convolutes the API even more. Both parameter modify the resulting shader code in pass2 rendering (only). The used 'renderMode' is still maintained within the Region, since it contains more dynamic states individual to each Region instance (color-texture, ..). This despite 'renderMode' also changes the RenderState's shader program. In the end, it really doesn't matter and is a choice of frequency - the pipeline is usually rendering from on OpenGL rendering thread sequentially. AA-Quality and SampleCount simply usually don't change that often and are set only once.
Diffstat (limited to 'src/demos/com/jogamp/opengl')
-rw-r--r--src/demos/com/jogamp/opengl/demos/av/MovieCube.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/av/MovieSimple.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java7
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java7
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java7
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java20
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java28
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java17
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java9
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java8
-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.java12
17 files changed, 74 insertions, 85 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java
index f26bce920..40890e70d 100644
--- a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java
+++ b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java
@@ -157,8 +157,6 @@ public class MovieCube implements GLEventListener {
resetGLState = true;
}
- final int[] textSampleCount = { 4 };
-
private final class InfoTextRendererGLELBase extends TextRendererGLELBase {
private static final float z_diff = 0.001f;
private final Font font = getFont(0, 0, 0);
@@ -169,10 +167,10 @@ public class MovieCube implements GLEventListener {
InfoTextRendererGLELBase(final GLProfile glp, final int rmode) {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
- super(rmode, MovieCube.this.textSampleCount);
+ super(rmode, Region.DEFAULT_AA_SAMPLE_COUNT);
this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
regionFPS = GLRegion.create(glp, renderModes, null, 0, 0);
- System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+textSampleCount[0]+", class "+regionFPS.getClass().getName());
+ System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+Region.DEFAULT_AA_SAMPLE_COUNT+", class "+regionFPS.getClass().getName());
staticRGBAColor[0] = 0.1f;
staticRGBAColor[1] = 0.1f;
staticRGBAColor[2] = 0.1f;
diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java b/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
index 006f13e72..602bde1a0 100644
--- a/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
+++ b/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
@@ -136,8 +136,6 @@ public class MovieSBSStereo implements StereoGLEventListener {
defURI = _defURI;
}
- final int[] textSampleCount = { 4 };
-
private final class InfoTextRendererGLELBase extends TextRendererGLELBase {
private final Font font = getFont(0, 0, 0);
private final float fontSize = 1f; // 0.01f;
@@ -145,10 +143,10 @@ public class MovieSBSStereo implements StereoGLEventListener {
InfoTextRendererGLELBase(final GLProfile glp, final int rmode) {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
- super(rmode, textSampleCount);
+ super(rmode, Region.DEFAULT_AA_SAMPLE_COUNT);
this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
regionFPS = GLRegion.create(glp, renderModes, null, 0, 0);
- System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+textSampleCount[0]+", class "+regionFPS.getClass().getName());
+ System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+Region.DEFAULT_AA_SAMPLE_COUNT+", class "+regionFPS.getClass().getName());
staticRGBAColor[0] = 0.9f;
staticRGBAColor[1] = 0.9f;
staticRGBAColor[2] = 0.9f;
diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java
index 4e537c7e5..9adbb5f48 100644
--- a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java
+++ b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java
@@ -116,8 +116,6 @@ public class MovieSimple implements GLEventListener {
defURI = _defURI;
}
- final int[] textSampleCount = { 4 };
-
private final class InfoTextRendererGLELBase extends TextRendererGLELBase {
private final Font font = getFont(0, 0, 0);
private final float fontSize = 10f;
@@ -125,10 +123,10 @@ public class MovieSimple implements GLEventListener {
InfoTextRendererGLELBase(final GLProfile glp, final int rmode) {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
- super(rmode, textSampleCount);
+ super(rmode, Region.DEFAULT_AA_SAMPLE_COUNT);
this.setRendererCallbacks(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
regionFPS = GLRegion.create(glp, renderModes, null, 0, 0);
- System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+textSampleCount[0]+", class "+regionFPS.getClass().getName());
+ System.err.println("RegionFPS "+Region.getRenderModeString(renderModes)+", sampleCount "+Region.DEFAULT_AA_SAMPLE_COUNT+", class "+regionFPS.getClass().getName());
staticRGBAColor[0] = 0.9f;
staticRGBAColor[1] = 0.9f;
staticRGBAColor[2] = 0.9f;
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
index 9756f7413..b3d2c84d7 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
@@ -53,8 +53,9 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 {
public GPURegionGLListener00 (final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) {
super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
- setMatrix(-20, 00, -50, 0f, sampleCount);
- setAAQuality(aaQuality);
+ setMatrix(-20, 00, -50, 0f);
+ getRenderer().setAAQuality(aaQuality);
+ getRenderer().setSampleCount(sampleCount);
}
private void createTestOutline(final GLProfile glp){
@@ -126,7 +127,7 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
+ region.draw(gl, regionRenderer);
regionRenderer.enable(gl, false);
}
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java
index 4361f30ef..989b0050e 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java
@@ -62,8 +62,9 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
this.shape_ctor_mode = shape_ctor_mode;
this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
- setMatrix(-20, 00, -50, 0f, sampleCount);
- setAAQuality(aaQuality);
+ setMatrix(-20, 00, -50, 0f);
+ getRenderer().setAAQuality(aaQuality);
+ getRenderer().setSampleCount(sampleCount);
}
private void createTestOutline00(){
@@ -293,7 +294,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
+ region.draw(gl, regionRenderer);
regionRenderer.enable(gl, false);
}
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java
index c069c9346..99a81cb31 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java
@@ -55,8 +55,9 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 {
public GPURegionGLListener10 (final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) {
super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
- setMatrix(-20, 00, -50, 0f, sampleCount);
- setAAQuality(aaQuality);
+ setMatrix(-20, 00, -50, 0f);
+ getRenderer().setAAQuality(aaQuality);
+ getRenderer().setSampleCount(sampleCount);
}
private void createTestOutline(final GLProfile glp){
@@ -133,7 +134,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
+ region.draw(gl, regionRenderer);
regionRenderer.enable(gl, false);
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
index bbee3a419..0c3bbf4d8 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
@@ -90,8 +90,6 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
private float yTran = 10;
private float ang = 0f;
private float zTran = -70f;
- private int graphAAQuality = Region.DEFAULT_AA_QUALITY;
- private final int[] sampleCount = new int[] { 4 };
protected volatile float weight = 1.0f;
boolean ignoreInput = false;
@@ -112,18 +110,13 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
public final float getYTran() { return yTran; }
public final float getAngleDeg() { return ang; }
public final float getAngleRad() { return FloatUtil.adegToRad(ang); }
- public final int[] getSampleCount() { return sampleCount; }
public final float[] getPosition() { return position; }
- public final void setAAQuality(final int v) { graphAAQuality = Region.clipAAQuality(v); }
- public final int getAAQuality() { return graphAAQuality; }
-
- public void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle, final int sampleCount) {
+ public void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle) {
this.xTran = xtrans;
this.yTran = ytrans;
this.zTran = zTran;
this.ang = angle;
- this.sampleCount[0] = sampleCount;
}
@Override
@@ -243,7 +236,8 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
}
public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException {
- final String sw = String.format("_s%02d-%s-Z%04d-snap%02d-%03dx%03d", sampleCount[0], objName, (int)Math.abs(zTran), screenshot_num++, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
+ final String sw = String.format("_s%02d-%s-Z%04d-snap%02d-%03dx%03d", getRenderer().getSampleCount(), objName, (int)Math.abs(zTran),
+ screenshot_num++, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
final String filename = dir + tech + sw +".png";
if(screenshot.readPixels(drawable.getGL(), false)) {
screenshot.write(new File(filename));
@@ -300,12 +294,12 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
move(1, 0);
}
else if(arg0.getKeyCode() == KeyEvent.VK_6){
- sampleCount[0] -= 1;
- System.err.println("Sample Count: " + sampleCount[0]);
+ getRenderer().setSampleCount( getRenderer().getSampleCount() - 1 );
+ System.err.println("Sample Count: " + getRenderer().getSampleCount());
}
else if(arg0.getKeyCode() == KeyEvent.VK_7){
- sampleCount[0] += 1;
- System.err.println("Sample Count: " + sampleCount[0]);
+ getRenderer().setSampleCount( getRenderer().getSampleCount() + 1 );
+ System.err.println("Sample Count: " + getRenderer().getSampleCount());
}
else if(arg0.getKeyCode() == KeyEvent.VK_0){
rotate(1);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java
index 52c50cc38..461b0eeab 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java
@@ -79,7 +79,6 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
boolean drawFPS = true;
final float fontSizeFName = 10f;
final float fontSizeFPS = 10f;
- final int[] sampleCountFPS = new int[] { 8 };
float fontSizeHead = 12f;
float fontSizeCenter = 16f;
float dpiV = 96;
@@ -158,8 +157,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
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);
- setAAQuality(aaQuality);
+ setMatrix(0, 0, 0, 0f);
+ getRenderer().setAAQuality(aaQuality);
+ getRenderer().setSampleCount(sampleCount);
}
void switchHeadBox() {
@@ -309,6 +309,8 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
final float mmSizeHead = pixelSizeHead / ppmmV;
final float pixelSizeCenter = FontScale.toPixels(fontSizeCenter, dpiV);
final float mmSizeCenter = pixelSizeCenter / ppmmV;
+ final int pass2AAQual = getRenderer().getAAQuality();
+ final int pass2Samples = getRenderer().getSampleCount();
renderer.enable(gl, true);
@@ -324,12 +326,12 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
lfps = 0f;
tfps = 0f;
}
- final String modeS = Region.getRenderModeString(regionFPS.getRenderModes())+"-q"+getAAQuality();
- 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",
+ final String modeS = Region.getRenderModeString(regionFPS.getRenderModes())+"-q"+pass2AAQual;
+ 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], blend %b, alpha %d",
lfps, tfps, gl.getSwapInterval(), dpiV, ppmmV,
fontSizeHead, pixelSizeHead, mmSizeHead,
fontSizeCenter, pixelSizeCenter, mmSizeCenter,
- modeS, getSampleCount()[0], sampleCountFPS[0],
+ modeS, pass2Samples,
renderer.isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED),
drawable.getChosenGLCapabilities().getAlphaBits());
@@ -340,7 +342,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.scaleMv(sxy, sxy, 1.0f);
}
// No cache, keep region alive!
- TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, getAAQuality(), sampleCountFPS, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, tempT1, tempT2);
pmv.popMv();
}
@@ -355,7 +357,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.scaleMv(sxy, sxy, 1.0f);
}
// System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
- textRegionUtil.drawString3D(gl, renderer, font, fontName, null, getAAQuality(), getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, fontName, null);
pmv.popMv();
}
@@ -371,7 +373,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.scaleMv(sxy, sxy, 1.0f);
}
// pmv.glTranslatef(x0, y1, z0);
- textRegionUtil.drawString3D(gl, renderer, font, headtext, null, getAAQuality(), getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, headtext, null);
pmv.popMv();
}
@@ -394,15 +396,15 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
if(!userInput) {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getAAQuality(), getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, text2, null, getAAQuality(), getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, text2, null);
}
} else {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getAAQuality(), getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getAAQuality(), getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null);
}
}
pmv.popMv();
diff --git a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java
index 026b32b0b..09a4546c6 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java
@@ -48,7 +48,7 @@ import com.jogamp.newt.Window;
public abstract class TextRendererGLELBase implements GLEventListener {
public final int renderModes;
- protected final int[] vbaaSampleCount;
+ protected final int pass2SampleCount;
protected final float[] staticRGBAColor = new float[] { 1f, 1f, 1f, 1f };
private boolean exclusivePMVMatrix = true;
@@ -88,9 +88,9 @@ public abstract class TextRendererGLELBase implements GLEventListener {
* @param sampleCount desired multisampling sample count for msaa-rendering.
* @see #setRendererCallbacks(com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback)
*/
- public TextRendererGLELBase(final int renderModes, final int[] sampleCount) {
+ public TextRendererGLELBase(final int renderModes, final int sampleCount) {
this.renderModes = renderModes;
- this.vbaaSampleCount = sampleCount;
+ this.pass2SampleCount = sampleCount;
}
/**
@@ -122,7 +122,6 @@ public abstract class TextRendererGLELBase implements GLEventListener {
public void setFlipVerticalInGLOrientation(final boolean v) { flipVerticalInGLOrientation=v; }
public final RegionRenderer getRenderer() { return renderer; }
public final TextRegionUtil getTextRenderUtil() { return textRenderUtil; }
- public int[] getVBAASampleCount() { return this.vbaaSampleCount; }
public PMVMatrix4f getMatrix() { return renderer.getMatrix(); };
public boolean isMatrixShared() { return !exclusivePMVMatrix; };
@@ -131,6 +130,8 @@ public abstract class TextRendererGLELBase implements GLEventListener {
public void init(final GLAutoDrawable drawable) {
exclusivePMVMatrix = null == sharedPMVMatrix;
renderer = RegionRenderer.create(sharedPMVMatrix, enableCallback, disableCallback);
+ renderer.setAAQuality(Region.DEFAULT_AA_QUALITY);
+ renderer.setSampleCount(pass2SampleCount);
renderer.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
this.textRenderUtil = new TextRegionUtil(renderModes);
final GL2ES2 gl = drawable.getGL().getGL2ES2();
@@ -262,11 +263,11 @@ public abstract class TextRendererGLELBase implements GLEventListener {
}
renderer.enable(gl, true);
if( cacheRegion ) {
- textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount);
+ textRenderUtil.drawString3D(gl, renderer, font, text, null);
} else if( null != region ) {
- TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, tempT1, tempT2);
} else {
- TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, tempT1, tempT2);
}
renderer.enable(gl, false);
@@ -310,7 +311,7 @@ public abstract class TextRendererGLELBase implements GLEventListener {
pmvMatrix.scaleMv(sxy, sxy, 1.0f);
}
renderer.enable(gl, true);
- region.draw(gl, renderer, Region.DEFAULT_AA_QUALITY, vbaaSampleCount);
+ region.draw(gl, renderer);
renderer.enable(gl, false);
if( !exclusivePMVMatrix ) {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
index 636819aa5..0788ab69e 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -178,8 +178,6 @@ public class UIGraphDemoU01a {
private final Vec2f worldDim = new Vec2f(1f, 1f);
/** World origin (bottom left) offset. */
private final Vec3f worldOrigin = new Vec3f();
- /** Sample count for Graph-VBAA */
- private final int[] sampleCount = { options.graphAASamples };
/** Graph region renderer */
private final RegionRenderer renderer;
/** The Graph region for text */
@@ -200,6 +198,8 @@ public class UIGraphDemoU01a {
sceneDist = -zNear;
}
renderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ renderer.setAAQuality(options.graphAAQuality);
+ renderer.setSampleCount(options.graphAASamples);
}
@Override
@@ -211,7 +211,6 @@ public class UIGraphDemoU01a {
shape = new CrossHair(options.renderModes, normWidgetSize, normWidgetSize, normWidgetSize/100f); // normalized: 1 is 100% surface size (width and/or height)
shape.setTextureUnit(pass2TexUnit);
shape.setColor(0, 0, 1, 1);
- shape.setAAQuality(options.graphAAQuality);
System.err.println("Init: Shape bounds "+shape.getBounds(drawable.getGLProfile()));
System.err.println("Init: Shape "+shape);
}
@@ -310,7 +309,7 @@ public class UIGraphDemoU01a {
pmv.pushMv();
shape.setTransformMv(pmv);
- shape.draw(gl, renderer, sampleCount);
+ shape.draw(gl, renderer);
if( onceAtDisplay ) {
final Matrix4f p = pmv.getP();
final Matrix4f mv = pmv.getMv();
@@ -336,7 +335,7 @@ public class UIGraphDemoU01a {
final float txt_scale = full_width_s < full_height_s ? full_width_s * normWidgetSize : full_height_s * normWidgetSize;
pmv.scaleMv(txt_scale, txt_scale, 1f);
pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f);
- final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, options.graphAAQuality, sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, tempT1, tempT2);
if( onceAtDisplay ) {
System.err.println("XXX: full_width: "+worldDim.x()+" / "+txt_box_em.getWidth()+" -> "+full_width_s);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
index 503c6ef85..b36a6272a 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
@@ -252,7 +252,7 @@ public class UISceneDemo02 {
final float dx = -1f * velocity_obj * dt_s; // [shapeUnit]
movingGlyph.move(dx, 0f, 0f);
final String text = String.format("%s, anim-duration %.1f s",
- scene.getStatusText(drawable, options.renderModes, 0, dpiV), req_total_dur_s);
+ scene.getStatusText(drawable, options.renderModes, dpiV), req_total_dur_s);
statusLabel.setText(text);
return true;
});
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
index 55f798aca..10ddf8c78 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -574,7 +574,7 @@ public class UISceneDemo03 {
animGroup.getRotation().rotateByAngleY( frame_velocity * dir );
}
final String text = String.format("%s, v %.1f mm/s, r %.3f rad/s",
- scene.getStatusText(drawable, options.renderModes, 0, dpiV), velocity * 1e3f, ang_velo);
+ scene.getStatusText(drawable, options.renderModes, dpiV), velocity * 1e3f, ang_velo);
statusLabel.setText(text);
}
@Override
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
index 65645caba..5551d4701 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -570,7 +570,7 @@ public class UISceneDemo20 implements GLEventListener {
public void mouseClicked(final MouseEvent e) {
final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
if( shapeEvent.shape instanceof GraphShape ) {
- int quality = ((GraphShape)shapeEvent.shape).getAAQuality();
+ int quality = scene.getAAQuality();
if( shapeEvent.objPos.x() < shapeEvent.shape.getBounds().getCenter().x() ) {
// left-half pressed
quality--;
@@ -1079,7 +1079,7 @@ public class UISceneDemo20 implements GLEventListener {
truePtSizeLabel.moveTo(dxMiddleAbs, dyTopLabelAbs - jogampLabel.getScaledLineHeight() - truePtSizeLabel.getScaledLineHeight(), dz);
}
{
- final AABBox fbox = fontFPS.getGlyphBounds(scene.getStatusText(drawable, renderModes, fpsLabel.getAAQuality(), dpiV));
+ final AABBox fbox = fontFPS.getGlyphBounds(scene.getStatusText(drawable, renderModes, dpiV));
final float scale = sceneWidth / ( 1.4f * fbox.getWidth() ); // add 40% width
fpsLabel.setScale(scale, scale, 1f);
fpsLabel.moveTo(sceneBox.getMinX(), sceneBox.getMinY() + scale * ( fontFPS.getMetrics().getLineGap() - fontFPS.getMetrics().getDescent() ), 0f);
@@ -1135,7 +1135,7 @@ public class UISceneDemo20 implements GLEventListener {
if( fpsLabel.isVisible() ) {
final String text;
if( null == actionText ) {
- text = scene.getStatusText(drawable, renderModes, fpsLabel.getAAQuality(), dpiV);
+ text = scene.getStatusText(drawable, renderModes, dpiV);
} else if( null != drawable.getAnimator() ) {
text = Scene.getStatusText(drawable.getAnimator())+", "+actionText;
} else {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
index 06917c182..6787722b1 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeClippingDemo00.java
@@ -203,6 +203,8 @@ public class UIShapeClippingDemo00 implements GLEventListener {
public UIShapeClippingDemo00(final int renderModes, final boolean debug, final boolean trace) {
this.renderModes = renderModes;
this.rRenderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ this.rRenderer.setAAQuality(options.graphAAQuality);
+ this.rRenderer.setSampleCount(options.graphAASamples);
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
@@ -250,14 +252,12 @@ public class UIShapeClippingDemo00 implements GLEventListener {
}
}
- final int[] sampleCount = { 4 };
-
private void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape shape) {
final PMVMatrix4f pmv = renderer.getMatrix();
pmv.pushMv();
if( null != shape && shape.isVisible() ) {
shape.setTransformMv(pmv);
- shape.draw(gl, renderer, sampleCount);
+ shape.draw(gl, renderer);
}
pmv.popMv();
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java
index a9c3ca13f..5618b12ac 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java
@@ -108,11 +108,11 @@ public class UIShapeDemo00 {
public void keyPressed(final KeyEvent arg0) {
final short keySym = arg0.getKeySymbol();
if( keySym == KeyEvent.VK_RIGHT ) {
- scene.setAAQuality( shape.getAAQuality() + 1 );
- System.err.println("AA Quality "+shape.getAAQuality());
+ scene.setAAQuality( scene.getAAQuality() + 1 );
+ System.err.println("AA Quality "+scene.getAAQuality());
} else if( keySym == KeyEvent.VK_LEFT ) {
- scene.setAAQuality( shape.getAAQuality() - 1 );
- System.err.println("AA Quality "+shape.getAAQuality());
+ scene.setAAQuality( scene.getAAQuality() - 1 );
+ System.err.println("AA Quality "+scene.getAAQuality());
} else if( keySym == KeyEvent.VK_UP ) {
scene.setSampleCount(scene.getSampleCount() + 1); // validated / clipped
System.err.println("AA Samples "+scene.getSampleCount());
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 d814dbc63..cca86df68 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
@@ -172,6 +172,8 @@ public class UIShapeDemo01 implements GLEventListener {
this.font = font;
this.renderModes = renderModes;
this.rRenderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ this.rRenderer.setAAQuality(options.graphAAQuality);
+ this.rRenderer.setSampleCount(options.graphAASamples);
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
@@ -180,7 +182,6 @@ public class UIShapeDemo01 implements GLEventListener {
final float sz2 = 1/20f;
button = new Button(renderModes, font, "Click me!", sz1_w, sz1_w/2f);
button.setLabelColor(0.0f,0.0f,0.0f, 1.0f);
- button.setAAQuality(options.graphAAQuality);
/** Button defaults !
button.setLabelColor(1.0f,1.0f,1.0f);
button.setButtonColor(0.6f,0.6f,0.6f);
@@ -190,7 +191,6 @@ public class UIShapeDemo01 implements GLEventListener {
System.err.println(button);
crossHair = new CrossHair(renderModes, sz2, sz2, 1/1000f);
crossHair.setColor(0f,0f,1f,1f);
- crossHair.setAAQuality(options.graphAAQuality);
crossHair.setVisible(true);
}
@@ -233,13 +233,11 @@ public class UIShapeDemo01 implements GLEventListener {
}
}
- final int[] sampleCount = { options.graphAASamples };
-
private void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape shape) {
final PMVMatrix4f pmv = renderer.getMatrix();
pmv.pushMv();
shape.setTransformMv(pmv);
- shape.draw(gl, renderer, sampleCount);
+ shape.draw(gl, renderer);
if( once ) {
System.err.println("draw.0: "+shape);
final int[] winSize = shape.getSurfaceSize(pmv, renderer.getViewport(), new int[2]);
@@ -292,7 +290,7 @@ public class UIShapeDemo01 implements GLEventListener {
pmv.pushMv();
pmv.scaleMv(txt_scale, txt_scale, 1f);
pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f);
- final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ), options.graphAAQuality, sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ));
if( once ) {
final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text);
System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s);
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 f2c66121b..a131c0fd5 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
@@ -195,13 +195,14 @@ public class UITypeDemo01 implements GLEventListener {
this.glyph_id = glyph_id;
this.renderModes = renderModes;
this.rRenderer = RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ this.rRenderer.setAAQuality(options.graphAAQuality);
+ this.rRenderer.setSampleCount(options.graphAASamples);
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
crossHair = new CrossHair(renderModes, 1/20f, 1/20f, 1/1000f);
crossHair.setColor(0f,0f,1f,1f);
- crossHair.setAAQuality(options.graphAAQuality);
crossHair.setVisible(true);
if (false ) {
@@ -217,7 +218,6 @@ public class UITypeDemo01 implements GLEventListener {
testObj = o;
}
testObj.setColor(0f, 0f, 0f, 1f);
- testObj.setAAQuality(options.graphAAQuality);
testObj.setVisible(true);
}
@@ -259,12 +259,10 @@ public class UITypeDemo01 implements GLEventListener {
}
float lastWidth = 0f, lastHeight = 0f;
- final int[] sampleCount = { options.graphAASamples };
-
private void drawShape(final GL2ES2 gl, final PMVMatrix4f pmv, final RegionRenderer renderer, final Shape shape) {
pmv.pushMv();
shape.setTransformMv(pmv);
- shape.draw(gl, renderer, sampleCount);
+ shape.draw(gl, renderer);
pmv.popMv();
}
@@ -333,7 +331,7 @@ public class UITypeDemo01 implements GLEventListener {
if( null != glyph.getShape() ) {
final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, glyph.getShape());
region.addOutlineShape(glyph.getShape(), null, fg_color);
- region.draw(gl, renderer, options.graphAAQuality, sampleCount);
+ region.draw(gl, renderer);
region.destroy(gl);
}
if( once ) {
@@ -351,7 +349,7 @@ public class UITypeDemo01 implements GLEventListener {
final float txt_scale = full_width_s < full_height_s ? full_width_s/2f : full_height_s/2f;
pmv.scaleMv(txt_scale, txt_scale, 1f);
pmv.translateMv(-txt_box_em.getWidth(), 0f, 0f);
- final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, options.graphAAQuality, sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, tempT1, tempT2);
if( once ) {
final AABBox txt_box_em2 = font.getGlyphShapeBounds(null, text);
System.err.println("XXX: full_width: "+full_width_o+" / "+txt_box_em.getWidth()+" -> "+full_width_s);