aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-15 04:47:34 +0100
committerSven Göthel <[email protected]>2024-01-15 04:47:34 +0100
commitd7cb4a77b71cb3703ff7ac0667c5a97f29a5bdb4 (patch)
tree17cb67b7867f0da11a2717492d691a5e96f52636
parent9b8d1825cfb76454e42b196a93dc54d189a8a9a6 (diff)
Graph/GraphUI AA-Quality (shader): Region: Add DEFAULT_AA_QUALITY and clipping funs for aaQuality/sampleCount; TextRegionUtil: Pass quality parameter in draw-functions
Region.DEFAULT_AA_QUALITY defaults to MAX_AA_QUALITY still - TODO: AA shader is subject to change .. Region.draw(..) clips the quality param (save) TextRegionUtil: Pass quality parameter in draw-functions - Allowing to select the AA shader GraphUI Scene and some demos add the AA-quality param to the status line or screenshot-filename. - See Region.getRenderModeString(..) +++ TestTextRendererNEWT20 and TestTextRendererNEWT21 now iterate through all fonts, AA-quality shader and sample-sizes. Most demos and some more tests take AA-quality into acount, demos via CommandlineOptions.graphAAQuality
-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.java5
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java4
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java4
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java19
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java7
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java1
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java1
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java1
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java1
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java1
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java13
-rw-r--r--src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java7
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java10
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/GraphShape.java24
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java14
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java40
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Shape.java24
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java21
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java31
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPUTextRendererListenerBase01.java21
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java71
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java86
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java10
41 files changed, 288 insertions, 226 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
index 0326ce075..9756f7413 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java
@@ -32,7 +32,6 @@ import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
@@ -40,7 +39,6 @@ import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.math.Vec4f;
import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.opengl.util.PMVMatrix;
/** Demonstrate the rendering of multiple outlines into one region/OutlineShape
* These Outlines are not necessary connected or contained.
@@ -52,10 +50,11 @@ import com.jogamp.opengl.util.PMVMatrix;
public class GPURegionGLListener00 extends GPURendererListenerBase01 {
OutlineShape outlineShape = null;
- public GPURegionGLListener00 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
+ 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);
}
private void createTestOutline(final GLProfile glp){
@@ -127,7 +126,7 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount());
+ region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
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 78aee8dd3..4361f30ef 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java
@@ -55,14 +55,15 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
OutlineShape outlineShape = null;
public GPURegionGLListener01 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
- this(1, renderModes, sampleCount, debug, trace);
+ this(1, renderModes, Region.DEFAULT_AA_QUALITY, sampleCount, debug, trace);
}
- public GPURegionGLListener01 (final int shape_ctor_mode, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
+ public GPURegionGLListener01 (final int shape_ctor_mode, 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.shape_ctor_mode = shape_ctor_mode;
this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
setMatrix(-20, 00, -50, 0f, sampleCount);
+ setAAQuality(aaQuality);
}
private void createTestOutline00(){
@@ -292,7 +293,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount());
+ region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
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 b397e991e..c069c9346 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java
@@ -52,10 +52,11 @@ import com.jogamp.opengl.util.PMVMatrix;
public class GPURegionGLListener10 extends GPURendererListenerBase01 {
List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>();
- public GPURegionGLListener10 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
+ 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);
}
private void createTestOutline(final GLProfile glp){
@@ -132,7 +133,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount());
+ region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
regionRenderer.enable(gl, false);
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java
index 33a7be35a..908b776cc 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionNewtDemo.java
@@ -130,7 +130,7 @@ public class GPURegionNewtDemo {
window.setSize(width, height);
window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
- final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rmode, sampleCount, DEBUG, TRACE);
+ final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (shape_ctor_mode, rmode, Region.DEFAULT_AA_QUALITY, sampleCount, DEBUG, TRACE);
regionGLListener.attachInputListenerTo(window);
window.addGLEventListener(regionGLListener);
window.setVisible(true);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
index ebc8846e3..bbee3a419 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
@@ -90,6 +90,7 @@ 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;
@@ -114,6 +115,9 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
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) {
this.xTran = xtrans;
this.yTran = ytrans;
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java
index 1f6be695c..cc6880fcc 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextGLListener0A.java
@@ -37,8 +37,8 @@ import com.jogamp.newt.opengl.GLWindow;
public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 {
- 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);
+ public GPUTextGLListener0A(final GLProfile glp, final int renderModes, final int aaQuality, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) {
+ super(glp, renderModes, aaQuality, 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 25eae1156..190c61a9a 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextNewtDemo.java
@@ -140,7 +140,7 @@ public class GPUTextNewtDemo {
window.setSize(width, height);
window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
- final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rmode, sampleCount, true, DEBUG, TRACE);
+ final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(glp, rmode, Region.DEFAULT_AA_QUALITY, 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 16d8aa1db..52c50cc38 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPUTextRendererListenerBase01.java
@@ -148,7 +148,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
Window upstream_window = null;
StringBuilder userString = new StringBuilder(textX1);
boolean userInput = false;
- public GPUTextRendererListenerBase01(final GLProfile glp, 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 aaQuality, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) {
// NOTE_ALPHA_BLENDING: We use alpha-blending
super(RegionRenderer.create(blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null),
renderModes, debug, trace);
@@ -159,6 +159,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
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);
}
void switchHeadBox() {
@@ -323,7 +324,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
lfps = 0f;
tfps = 0f;
}
- final String modeS = Region.getRenderModeString(regionFPS.getRenderModes());
+ 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",
lfps, tfps, gl.getSwapInterval(), dpiV, ppmmV,
fontSizeHead, pixelSizeHead, mmSizeHead,
@@ -339,7 +340,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, sampleCountFPS, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, getAAQuality(), sampleCountFPS, tempT1, tempT2);
pmv.popMv();
}
@@ -354,7 +355,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, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, fontName, null, getAAQuality(), getSampleCount());
pmv.popMv();
}
@@ -370,7 +371,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, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, headtext, null, getAAQuality(), getSampleCount());
pmv.popMv();
}
@@ -393,15 +394,15 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
if(!userInput) {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getAAQuality(), getSampleCount(), tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, text2, null, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, text2, null, getAAQuality(), getSampleCount());
}
} else {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getAAQuality(), getSampleCount(), tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getAAQuality(), getSampleCount());
}
}
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 9bd403341..026b32b0b 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java
@@ -262,11 +262,11 @@ public abstract class TextRendererGLELBase implements GLEventListener {
}
renderer.enable(gl, true);
if( cacheRegion ) {
- textRenderUtil.drawString3D(gl, renderer, font, text, null, vbaaSampleCount);
+ textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount);
} else if( null != region ) {
- TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
} else {
- TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
}
renderer.enable(gl, false);
@@ -310,7 +310,7 @@ public abstract class TextRendererGLELBase implements GLEventListener {
pmvMatrix.scaleMv(sxy, sxy, 1.0f);
}
renderer.enable(gl, true);
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, vbaaSampleCount);
+ region.draw(gl, renderer, Region.DEFAULT_AA_QUALITY, vbaaSampleCount);
renderer.enable(gl, false);
if( !exclusivePMVMatrix ) {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
index 913c8062d..01a4b1824 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2023 JogAmp Community. All rights reserved.
+ * Copyright 2023-2024 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:
@@ -347,6 +347,7 @@ public class FontView01 {
}
}
scene.addShape(mainGrid);
+ scene.setAAQuality(options.graphAAQuality);
window.addKeyListener(new KeyAdapter() {
@Override
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 6235c481b..636819aa5 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -211,6 +211,7 @@ 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);
}
@@ -335,7 +336,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, sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, textRegion.clear(gl), renderer, font, text, text_color, options.graphAAQuality, sampleCount, 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/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java
index 9ab65d3d7..f49294415 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010-2023 JogAmp Community. All rights reserved.
+ * Copyright 2010-2024 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:
@@ -35,7 +35,7 @@ import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.font.FontSet;
import com.jogamp.graph.ui.Scene;
-import com.jogamp.graph.ui.Shape;
+import com.jogamp.graph.ui.GraphShape;
import com.jogamp.graph.ui.shapes.Button;
import com.jogamp.math.Recti;
import com.jogamp.math.geom.AABBox;
@@ -73,13 +73,14 @@ public class UISceneDemo00 {
final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF);
System.err.println("Font: "+font.getFullFamilyName());
- final Shape shape = new Button(options.renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height)
+ final GraphShape shape = new Button(options.renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height)
System.err.println("Shape bounds "+shape.getBounds(reqGLP));
final Scene scene = new Scene(options.graphAASamples);
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.addShape(shape);
+ scene.setAAQuality(options.graphAAQuality);
final Animator animator = new Animator(0 /* w/o AWT */);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
index 3aa2b6551..e57253dc5 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
@@ -84,6 +84,7 @@ public class UISceneDemo01 {
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.addShape(shape);
+ scene.setAAQuality(options.graphAAQuality);
final Animator animator = new Animator(0 /* w/o AWT */);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
index e723d48ba..a66f5af56 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
@@ -85,6 +85,7 @@ public class UISceneDemo01b {
final Scene scene = new Scene(options.graphAASamples);
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.addShape(shape);
+ scene.setAAQuality(options.graphAAQuality);
final Animator animator = new Animator(0 /* w/o AWT */);
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 b6d785733..503c6ef85 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
@@ -101,6 +101,7 @@ public class UISceneDemo02 {
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.addShape(destText);
scene.addShape(movingGlyph);
+ scene.setAAQuality(options.graphAAQuality);
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1*60, null); // System.err);
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 055348d99..55f798aca 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -446,6 +446,7 @@ public class UISceneDemo03 {
}
return true;
});
+ scene.setAAQuality(options.graphAAQuality);
final long t0_us = Clock.currentNanos() / 1000; // [us]
while ( ( null == dynAnimSet[0] || dynAnimSet[0].isAnimationActive() || animGroup.getTickPaused() ) && window.isNativeValid() ) {
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 bd8e3e402..65645caba 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -1012,6 +1012,8 @@ public class UISceneDemo20 implements GLEventListener {
initLabels(gl);
initButtons(gl);
+ scene.setAAQuality(options.graphAAQuality);
+
scene.init(drawable);
final GLAnimatorControl a = drawable.getAnimator();
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 aaef802f6..a9c3ca13f 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo00.java
@@ -78,6 +78,7 @@ public class UIShapeDemo00 {
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.addShape(shape);
+ scene.setAAQuality(options.graphAAQuality);
final Animator animator = new Animator(0 /* w/o AWT */);
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 67f466501..d814dbc63 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
@@ -180,6 +180,7 @@ 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);
@@ -189,6 +190,7 @@ 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);
}
@@ -231,7 +233,7 @@ public class UIShapeDemo01 implements GLEventListener {
}
}
- final int[] sampleCount = { 4 };
+ final int[] sampleCount = { options.graphAASamples };
private void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape shape) {
final PMVMatrix4f pmv = renderer.getMatrix();
@@ -290,7 +292,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 ), sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, new Vec4f( 0, 0, 0, 1 ), options.graphAAQuality, sampleCount, 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);
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 c1a5efe77..f2c66121b 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
@@ -39,6 +39,7 @@ import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.Font.Glyph;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.font.FontSet;
+import com.jogamp.graph.ui.GraphShape;
import com.jogamp.graph.ui.Shape;
import com.jogamp.graph.ui.shapes.CrossHair;
import com.jogamp.graph.ui.shapes.Rectangle;
@@ -167,7 +168,7 @@ public class UITypeDemo01 implements GLEventListener {
private final boolean trace;
private final CrossHair crossHair;
- private final Shape testObj;
+ private final GraphShape testObj;
private KeyAction keyAction;
private MouseAction mouseAction;
@@ -200,6 +201,7 @@ public class UITypeDemo01 implements GLEventListener {
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 ) {
@@ -209,12 +211,13 @@ public class UITypeDemo01 implements GLEventListener {
} else {
final float scale = 0.15312886f;
final float size_xz = 0.541f;
- final Shape o = new Glyph03FreeMonoRegular_M(renderModes);
+ final GraphShape o = new Glyph03FreeMonoRegular_M(renderModes);
o.scale(scale, scale, 1f);
// o.translate(size_xz, -size_xz, 0f);
testObj = o;
}
testObj.setColor(0f, 0f, 0f, 1f);
+ testObj.setAAQuality(options.graphAAQuality);
testObj.setVisible(true);
}
@@ -256,7 +259,7 @@ public class UITypeDemo01 implements GLEventListener {
}
float lastWidth = 0f, lastHeight = 0f;
- final int[] sampleCount = { 4 };
+ final int[] sampleCount = { options.graphAASamples };
private void drawShape(final GL2ES2 gl, final PMVMatrix4f pmv, final RegionRenderer renderer, final Shape shape) {
pmv.pushMv();
@@ -330,7 +333,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, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, options.graphAAQuality, sampleCount);
region.destroy(gl);
}
if( once ) {
@@ -348,7 +351,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, sampleCount, tempT1, tempT2);
+ final AABBox txt_box_r = TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, fg_color, options.graphAAQuality, sampleCount, 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);
diff --git a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
index d4d414252..a5e748ae8 100644
--- a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
+++ b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
@@ -38,6 +38,8 @@ public class CommandlineOptions {
public int sceneMSAASamples = 0;
/** Sample count for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT} */
public int graphAASamples = 0;
+ /** Pass2 AA-quality rendering for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. Defaults to {@link Region#DEFAULT_AA_QUALITY}. */
+ public int graphAAQuality = Region.DEFAULT_AA_QUALITY;
public boolean exclusiveContext = false;
public boolean wait_to_start = false;
public boolean keepRunning = false;
@@ -126,6 +128,9 @@ public class CommandlineOptions {
graphAASamples = MiscUtils.atoi(args[idx[0]], 4);
renderModes &= ~Region.AA_RENDERING_MASK;
renderModes |= Region.VBAA_RENDERING_BIT;
+ } else if(args[idx[0]].equals("-gaaq")) {
+ ++idx[0];
+ graphAAQuality = Region.clipAAQuality( MiscUtils.atoi(args[idx[0]], graphAAQuality) );
} else if(args[idx[0]].equals("-exclusiveContext")) {
exclusiveContext = true;
} else if(args[idx[0]].equals("-wait")) {
@@ -160,7 +165,7 @@ public class CommandlineOptions {
@Override
public String toString() {
return "Options{surface[width "+surface_width+" x "+surface_height+"], glp "+glProfileName+
- ", renderModes "+Region.getRenderModeString(renderModes)+
+ ", renderModes "+Region.getRenderModeString(renderModes)+", aa-q "+graphAAQuality+
", smsaa "+sceneMSAASamples+
", exclusiveContext "+exclusiveContext+", wait "+wait_to_start+", keep "+keepRunning+", stay "+stayOpen+", dur "+total_duration+"s"+
"}";
diff --git a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
index f28c8984e..2c733f1fc 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
@@ -383,7 +383,7 @@ public class AnimGroup extends Group {
{
refShape.setTransformMv(pmv);
as = new Set(pixPerMM, refShape.getPixelPerShapeUnit(pmv, viewport, new float[2]), refShape,
- accel, velocity, ang_accel, ang_velo, allShapes, sourceBounds, lerp);
+ accel, velocity, ang_accel, ang_velo, allShapes, sourceBounds, lerp);
}
pmv.popMv();
}
@@ -448,10 +448,10 @@ public class AnimGroup extends Group {
* @return newly created and added {@link Set}
*/
public final Set addGlyphSetRandom01(final float pixPerMM,
- final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes,
- final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol,
- final float accel, final float velocity, final float ang_accel, final float ang_velo,
- final AABBox animBox, final boolean z_only, final Random random, final LerpFunc lerp)
+ final GLProfile glp, final PMVMatrix4f pmv, final Recti viewport, final int renderModes,
+ final Font font, final CharSequence text, final float fontScale, final Vec4f fgCol,
+ final float accel, final float velocity, final float ang_accel, final float ang_velo,
+ final AABBox animBox, final boolean z_only, final Random random, final LerpFunc lerp)
{
return addGlyphSet(pixPerMM, glp, pmv, viewport, renderModes, font, 'X', text, fontScale,
accel, velocity, ang_accel, ang_velo, lerp, (final Set as, final int idx, final ShapeData sd) -> {
diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
index 1e00d72f7..65363fa2b 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java
@@ -58,7 +58,7 @@ public abstract class GraphShape extends Shape {
protected int pass2TexUnit = GLRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT;
protected GLRegion region = null;
protected float oshapeSharpness = OutlineShape.DEFAULT_SHARPNESS;
- private int regionPass2Quality = Region.MAX_AA_QUALITY;
+ private int regionPass2Quality = Region.DEFAULT_AA_QUALITY;
private final List<GLRegion> dirtyRegions = new ArrayList<GLRegion>();
/**
@@ -87,16 +87,22 @@ public abstract class GraphShape extends Shape {
public final int getRenderModes() { return renderModes; }
/**
- * Sets the shape's Graph {@link Region}'s pass2 AA-quality parameter. Default is {@link Region#MAX_AA_QUALITY}.
- * @param q Graph {@link Region}'s pass2 AA-quality parameter, default is {@link Region#MAX_AA_QUALITY}.
+ * Sets the shape's Graph {@link Region}'s pass2 AA-quality parameter. Default is {@link Region#DEFAULT_AA_QUALITY}.
+ * @param v Graph {@link Region}'s pass2 AA-quality parameter, default is {@link Region#DEFAULT_AA_QUALITY}.
* @return this shape for chaining.
*/
- public final GraphShape setAAQuality(final int q) {
- this.regionPass2Quality = q;
+ public final GraphShape setAAQuality(final int v) {
+ this.regionPass2Quality = Region.clipAAQuality(v);
markStateDirty();
return this;
}
+ /**
+ * Return the shape's Graph {@link Region}'s quality parameter.
+ * @see #setAAQuality(int)
+ */
+ public final int getAAQuality() { return regionPass2Quality; }
+
/** Set the 2nd pass texture unit. */
public void setTextureUnit(final int pass2TexUnit) {
this.pass2TexUnit = pass2TexUnit;
@@ -106,12 +112,6 @@ public abstract class GraphShape extends Shape {
}
/**
- * Return the shape's Graph {@link Region}'s quality parameter.
- * @see #setAAQuality(int)
- */
- public final int getAAQuality() { return regionPass2Quality; }
-
- /**
* Sets the shape's Graph {@link OutlineShape}'s sharpness parameter. Default is {@link OutlineShape#DEFAULT_SHARPNESS}.
*
* Method issues {@link #markShapeDirty()}.
@@ -228,7 +228,7 @@ public abstract class GraphShape extends Shape {
}
@Override
- protected final void validateImpl(final GLProfile glp, final GL2ES2 gl) {
+ protected final void validateImpl(final GL2ES2 gl, final GLProfile glp) {
if( null != gl ) {
clearDirtyRegions(gl);
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index 2267b70cc..d13fdef75 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -394,7 +394,7 @@ public class Group extends Shape implements Container {
}
@Override
- protected void validateImpl(final GLProfile glp, final GL2ES2 gl) {
+ protected void validateImpl(final GL2ES2 gl, final GLProfile glp) {
if( isShapeDirty() ) {
final boolean needsRMs = hasBorder() && null == border;
GraphShape firstGS = null;
@@ -410,11 +410,7 @@ public class Group extends Shape implements Container {
firstGS = (GraphShape)s;
}
layouter.preValidate(s);
- if( null != gl ) {
- s.validate(gl);
- } else {
- s.validate(glp);
- }
+ s.validate(gl, glp);
}
}
layouter.layout(this, box, pmv);
@@ -426,11 +422,7 @@ public class Group extends Shape implements Container {
if( needsRMs && null == firstGS && s instanceof GraphShape ) {
firstGS = (GraphShape)s;
}
- if( null != gl ) {
- s.validate(gl);
- } else {
- s.validate(glp);
- }
+ s.validate(gl, glp);
pmv.pushMv();
s.setTransformMv(pmv);
s.getBounds().transform(pmv.getMv(), tsbox);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index 7748a4eb0..d41378251 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -138,6 +138,7 @@ public final class Scene implements Container, GLEventListener {
private final RegionRenderer renderer;
private final int[] sampleCount = new int[1];
+ private int globalAAQuality = -1; // undefined
/** Describing the bounding box in shape's object model-coordinates of the near-plane parallel at its scene-distance, post {@link #translate(PMVMatrix4f)} */
private final AABBox planeBox = new AABBox(0f, 0f, 0f, 0f, 0f, 0f);
@@ -189,7 +190,7 @@ public final class Scene implements Container, GLEventListener {
throw new IllegalArgumentException("Null RegionRenderer");
}
this.renderer = renderer;
- this.sampleCount[0] = Math.min(Region.MAX_AA_SAMPLE_COUNT, Math.max(sampleCount, Region.MIN_AA_SAMPLE_COUNT)); // clip
+ this.sampleCount[0] = Region.clipAASampleCount(sampleCount);
this.screenshot = new GLReadBufferUtil(false, false);
}
@@ -368,7 +369,7 @@ public final class Scene implements Container, GLEventListener {
* @return clipped and set value
*/
public int setSampleCount(final int v) {
- sampleCount[0] = Math.min(Region.MAX_AA_SAMPLE_COUNT, Math.max(v, Region.MIN_AA_SAMPLE_COUNT)); // clip
+ sampleCount[0] = Region.clipAASampleCount(v);
markStatesDirty();
return sampleCount[0];
}
@@ -379,7 +380,8 @@ public final class Scene implements Container, GLEventListener {
* @return clipped and set value
*/
public void setAAQuality(final int v) {
- final int q = Math.min(Region.MAX_AA_QUALITY, Math.max(v, Region.MIN_AA_QUALITY)); // clip
+ final int q = Region.clipAAQuality(v);
+ globalAAQuality = q;
forAll((final Shape s) -> {
if( s instanceof GraphShape ) {
((GraphShape)s).setAAQuality(q);
@@ -387,6 +389,9 @@ public final class Scene implements Container, GLEventListener {
return false;
});
}
+ /** Returns the global AA quality value if set via {@link #setAAQuality(int)}, otherwise {@code -1}. */
+ public int getAAQuality() { return globalAAQuality; }
+
public void setSharpness(final float sharpness) {
forAll((final Shape s) -> {
if( s instanceof GraphShape ) {
@@ -1263,7 +1268,7 @@ public final class Scene implements Container, GLEventListener {
/**
* Return a formatted status string containing avg fps and avg frame duration.
* @param glad GLAutoDrawable instance for FPSCounter, its chosen GLCapabilities and its GL's swap-interval
- * @param renderModes render modes for {@link Region#getRenderModeString(int, int, int)}
+ * @param renderModes render modes for {@link Region#getRenderModeString(int, int, int, int)}
* @param quality the Graph-Curve quality setting or -1 to be ignored
* @param dpi the monitor's DPI (vertical preferred)
* @return formatted status string
@@ -1281,20 +1286,25 @@ public final class Scene implements Container, GLEventListener {
td = 0f;
}
final GLCapabilitiesImmutable caps = glad.getChosenGLCapabilities();
- final String modeS = Region.getRenderModeString(renderModes, getSampleCount(), caps.getNumSamples());
- final String qualityStr, blendStr;
- if( 0 <= quality ) {
- qualityStr = ", q "+quality;
- } else {
- qualityStr = "";
- }
+ final String modeS = Region.getRenderModeString(renderModes, quality, getSampleCount(), caps.getNumSamples());
+ final String blendStr;
if( getRenderer().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
blendStr = ", blend";
} else {
blendStr = "";
}
- return String.format("%03.1f/%03.1f fps, %.1f ms/f, vsync %d, dpi %.1f, %s%s%s, a %d",
- lfps, tfps, td, glad.getGL().getSwapInterval(), dpi, modeS, qualityStr, blendStr, caps.getAlphaBits());
+ return String.format("%03.1f/%03.1f fps, %.1f ms/f, vsync %d, dpi %.1f, %s%s, a %d",
+ lfps, tfps, td, glad.getGL().getSwapInterval(), dpi, modeS, blendStr, caps.getAlphaBits());
+ }
+ /**
+ * Return a formatted status string containing avg fps and avg frame duration using {@link #getAAQuality()}
+ * @param glad GLAutoDrawable instance for FPSCounter, its chosen GLCapabilities and its GL's swap-interval
+ * @param renderModes render modes for {@link Region#getRenderModeString(int, int, int, int)}
+ * @param dpi the monitor's DPI (vertical preferred)
+ * @return formatted status string
+ */
+ public String getStatusText(final GLAutoDrawable glad, final int renderModes, final float dpi) {
+ return getStatusText(glad, renderModes, globalAAQuality, dpi);
}
/**
@@ -1312,7 +1322,7 @@ public final class Scene implements Container, GLEventListener {
/**
* Return the unique next technical screenshot PNG {@link File} instance as follows:
* <pre>
- * filename = [{dir}][{prefix}-]{@link Region#getRenderModeString(int, int, int)}[-{contentDetails}]-snap{screenShotCount}-{resolution}.png
+ * filename = [{dir}][{prefix}-]{@link Region#getRenderModeString(int, int, int, int)}[-{contentDetails}]-snap{screenShotCount}-{resolution}.png
* </pre>
* Implementation increments {@link #getScreenshotCount()}.
*
@@ -1330,7 +1340,7 @@ public final class Scene implements Container, GLEventListener {
final String dir2 = ( null != dir && dir.length() > 0 ) ? dir : "";
final String prefix2 = ( null != prefix && prefix.length() > 0 ) ? prefix+"-" : "";
final RegionRenderer renderer = getRenderer();
- final String modeS = Region.getRenderModeString(renderModes, getSampleCount(), caps.getNumSamples());
+ final String modeS = Region.getRenderModeString(renderModes, globalAAQuality, getSampleCount(), caps.getNumSamples());
final String contentDetail2 = ( null != contentDetail && contentDetail.length() > 0 ) ? contentDetail+"-" : "";
return new File( String.format((Locale)null, "%s%s%s-%ssnap%02d-%04dx%04d.png",
dir2, prefix2, modeS, contentDetail2,
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
index 17b1f5344..225750b09 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
@@ -456,7 +456,7 @@ public abstract class Shape {
/** Return unscaled rotation origin, aka pivot. Null if not set via {@link #getRotationPivot()}. */
public final Vec3f getRotationPivot() { return rotPivot; }
/**
- * Set unscaled rotation origin, aka pivot. Usually the {@link #getBounds()} center and should be set while {@link #validateImpl(GLProfile, GL2ES2)}.
+ * Set unscaled rotation origin, aka pivot. Usually the {@link #getBounds()} center and should be set while {@link #validateImpl(GL2ES2, GLProfile)}.
* @return this shape for chaining
*/
public final Shape setRotationPivot(final float px, final float py, final float pz) {
@@ -464,7 +464,7 @@ public abstract class Shape {
return this;
}
/**
- * Set unscaled rotation origin, aka pivot. Usually the {@link #getBounds()} center and should be set while {@link #validateImpl(GLProfile, GL2ES2)}.
+ * Set unscaled rotation origin, aka pivot. Usually the {@link #getBounds()} center and should be set while {@link #validateImpl(GL2ES2, GLProfile)}.
* @param pivot rotation origin
* @return this shape for chaining
*/
@@ -688,7 +688,7 @@ public abstract class Shape {
if( isShapeDirty() ) {
box.reset();
}
- validateImpl(gl.getGLProfile(), gl);
+ validateImpl(gl, gl.getGLProfile());
dirty = 0;
}
return this;
@@ -707,13 +707,27 @@ public abstract class Shape {
if( isShapeDirty() ) {
box.reset();
}
- validateImpl(glp, null);
+ validateImpl(null, glp);
dirty = 0;
}
return this;
}
/**
+ * Validate the shape via {@link #validate(GL2ES2)} if {@code gl} is not null,
+ * otherwise uses {@link #validate(GLProfile)}.
+ * @see #validate(GL2ES2)
+ * @see #validate(GLProfile)
+ */
+ public final Shape validate(final GL2ES2 gl, final GLProfile glp) {
+ if( null != gl ) {
+ return validate(gl);
+ } else {
+ return validate(glp);
+ }
+ }
+
+ /**
* Setup the {@link PMVMatrix4f#getMv() modelview matrix} of the given {@link PMVMatrix4f} for this object.
* - Scale shape from its center position
* - Rotate shape around optional scaled pivot, see {@link #setRotationPivot(float[])}), otherwise rotate around its scaled center (default)
@@ -1822,7 +1836,7 @@ public abstract class Shape {
//
//
- protected abstract void validateImpl(final GLProfile glp, final GL2ES2 gl);
+ protected abstract void validateImpl(final GL2ES2 gl, final GLProfile glp);
/**
* Actual draw implementation, called by {@link #draw(GL2ES2, RegionRenderer, int[])}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index d49d68982..389af2a8b 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -173,15 +173,21 @@ public abstract class Region {
*/
public static final int COLORTEXTURE_LETTERBOX_RENDERING_BIT = 1 << 11;
- /** Minimum pass2 AA-quality rendering {@value} (default) for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
+ /** Minimum pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
public static final int MIN_AA_QUALITY = 0;
- /** Maximum pass2 AA-quality rendering {@value} (default) for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
+ /** Maximum pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
public static final int MAX_AA_QUALITY = 1;
+ /** Default pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
+ public static final int DEFAULT_AA_QUALITY = MAX_AA_QUALITY;
+ /** Returns clipped AA quality value to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}] */
+ public static final int clipAAQuality(final int v) { return Math.min(Region.MAX_AA_QUALITY, Math.max(v, Region.MIN_AA_QUALITY)); }
/** Minimum pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
public static final int MIN_AA_SAMPLE_COUNT = 1;
/** Maximum pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
public static final int MAX_AA_SAMPLE_COUNT = 8;
+ /** Returns clipped AA sample-count to [{@link Region#MIN_AA_SAMPLE_COUNT}..{@link Region#MAX_AA_SAMPLE_COUNT}] */
+ public static final int clipAASampleCount(final int v) { return Math.min(Region.MAX_AA_SAMPLE_COUNT, Math.max(v, Region.MIN_AA_SAMPLE_COUNT)); }
public static final int DEFAULT_TWO_PASS_TEXTURE_UNIT = 0;
@@ -283,15 +289,20 @@ public abstract class Region {
/**
* Return a unique technical description string for renderModes and sample counts as follows:
* <pre>
- * {@link #getRenderModeString(int)}-s{sampleCount}-fsaa{CapsNumSamples}
+ * {@link #getRenderModeString(int)}-q{AA-quality}-s{sampleCount}-fsaa{CapsNumSamples}
* </pre>
*
* @param renderModes the used Graph renderModes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}
+ * @param graphAAQuality Graph AA quality, see {@link #DEFAULT_AA_QUALITY}, set to negative value to mark undefined
* @param graphSampleCount Graph sample count for {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}
* @param fsaaSampleCount full-screen AA (fsaa) sample count, retrieved e.g. via {@link GLCapabilitiesImmutable#getNumSamples()}
*/
- public static String getRenderModeString(final int renderModes, final int graphSampleCount, final int fsaaSampleCount) {
- return String.format((Locale)null, "%s-s%02d-fsaa%d", Region.getRenderModeString(renderModes), graphSampleCount, fsaaSampleCount);
+ public static String getRenderModeString(final int renderModes, final int graphAAQuality, final int graphSampleCount, final int fsaaSampleCount) {
+ if( Region.MIN_AA_QUALITY > graphAAQuality ) {
+ return String.format((Locale)null, "%s-qu-s%02d-fsaa%d", Region.getRenderModeString(renderModes), graphSampleCount, fsaaSampleCount);
+ } else {
+ return String.format((Locale)null, "%s-q%01d-s%02d-fsaa%d", Region.getRenderModeString(renderModes), graphAAQuality, graphSampleCount, fsaaSampleCount);
+ }
}
protected Region(final int regionRenderModes, final boolean use_int32_idx) {
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 718f543c2..dfc7d3921 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -539,7 +539,7 @@ public abstract class GLRegion extends Region {
if( isShapeDirty() ) {
updateImpl(gl, renderer, curRenderModes);
}
- drawImpl(gl, renderer, curRenderModes, pass2Quality, sampleCount);
+ drawImpl(gl, renderer, curRenderModes, Region.clipAAQuality(pass2Quality), sampleCount);
clearDirtyBits(DIRTY_SHAPE|DIRTY_STATE);
lastRenderModes = curRenderModes;
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 225f42830..633bc38af 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -168,7 +168,7 @@ public class TextRegionUtil {
* @return the given int[2] storage for chaining
* @see Region#setBufferCapacity(int, int)
* @see Region#growBuffer(int, int)
- * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)
+ * @see #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)
*/
public static int[] countStringRegion(final Font font, final CharSequence str, final int[/*2*/] vertIndexCount) {
final Font.GlyphVisitor2 visitor = new Font.GlyphVisitor2() {
@@ -203,6 +203,7 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
+ * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
* @param sampleCount desired multisampling sample count for msaa-rendering.
* The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @return the bounding box of the given string from the produced and rendered GLRegion
@@ -210,7 +211,7 @@ public class TextRegionUtil {
*/
public AABBox drawString3D(final GL2ES2 gl,
final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int[/*1*/] sampleCount) {
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
if( !renderer.isInitialized() ) {
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -231,20 +232,20 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, int, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
* <p>
* The region's buffer size is pre-calculated via {@link GLRegion#create(com.jogamp.opengl.GLProfile, int, com.jogamp.opengl.util.texture.TextureSequence, Font, CharSequence)}
* </p>
*/
public static AABBox drawString3D(final GL2ES2 gl, final int renderModes,
final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int[/*1*/] sampleCount) {
- return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, sampleCount, new AffineTransform(), new AffineTransform());
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
+ return drawString3D(gl, renderModes, renderer, font, str, rgbaColor, aaQuality, sampleCount, new AffineTransform(), new AffineTransform());
}
/**
@@ -261,7 +262,7 @@ public class TextRegionUtil {
* <p>
* In case of a multisampling region renderer, i.e. {@link Region#VBAA_RENDERING_BIT}, recreating the {@link GLRegion}
* is a huge performance impact.
- * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)}
+ * In such case better use {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)}
* instead.
* </p>
* @param gl the current GL state
@@ -271,6 +272,7 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
+ * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
* @param sampleCount desired multisampling sample count for msaa-rendering.
* The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @param tmp1 temp {@link AffineTransform} to be reused
@@ -280,7 +282,7 @@ public class TextRegionUtil {
*/
public static AABBox drawString3D(final GL2ES2 gl, final int renderModes,
final RegionRenderer renderer, final Font font, final CharSequence str,
- final Vec4f rgbaColor, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -293,20 +295,20 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
region.destroy(gl);
return res;
}
/**
- * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
+ * Try using {@link #drawString3D(GL2ES2, GLRegion, RegionRenderer, Font, CharSequence, Vec4f, int, int[], AffineTransform, AffineTransform)} to reuse {@link AffineTransform} instances.
* <p>
* The region buffer's size is grown by pre-calculating required size via {@link #countStringRegion(Font, CharSequence, int[])}.
* </p>
*/
public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
- final Font font, final CharSequence str, final Vec4f rgbaColor, final int[/*1*/] sampleCount) {
- return drawString3D(gl, region, renderer, font, str, rgbaColor, sampleCount, new AffineTransform(), new AffineTransform());
+ final Font font, final CharSequence str, final Vec4f rgbaColor, final int aaQuality, final int[/*1*/] sampleCount) {
+ return drawString3D(gl, region, renderer, font, str, rgbaColor, aaQuality, sampleCount, new AffineTransform(), new AffineTransform());
}
/**
@@ -331,6 +333,7 @@ public class TextRegionUtil {
* @param rgbaColor used to fill the {@link Region#hasColorChannel() region's color-channel} if used
* and set {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} to white.
* Otherwise used to set the {@link RegionRenderer#setColorStatic(Vec4f) renderer's static-color} only, if not {@code null}.
+ * @param aaQuality pass2 AA-quality, clipped to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}]
* @param sampleCount desired multisampling sample count for msaa-rendering.
* The actual used scample-count is written back when msaa-rendering is enabled, otherwise the store is untouched.
* @param tmp1 temp {@link AffineTransform} to be reused
@@ -340,7 +343,7 @@ public class TextRegionUtil {
*/
public static AABBox drawString3D(final GL2ES2 gl, final GLRegion region, final RegionRenderer renderer,
final Font font, final CharSequence str, final Vec4f rgbaColor,
- final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
+ final int aaQuality, final int[/*1*/] sampleCount, final AffineTransform tmp1, final AffineTransform tmp2) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
@@ -352,7 +355,7 @@ public class TextRegionUtil {
} else {
renderer.setColorStatic(1, 1, 1, 1);
}
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCount);
+ region.draw(gl, renderer, aaQuality, sampleCount);
return res;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java
index 6c3bd692a..11343b4ee 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/FontViewListener01.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2023 JogAmp Community. All rights reserved.
+ * Copyright 2023-2024 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:
@@ -27,6 +27,7 @@
*/
package com.jogamp.opengl.test.junit.graph;
+import com.jogamp.graph.curve.Region;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontScale;
import com.jogamp.graph.ui.Group;
@@ -54,13 +55,15 @@ public class FontViewListener01 implements GLEventListener {
private boolean useDPI = false;
private final int renderModes;
+ private final int graphAAQuality;
private final char startCharSymbol;
private final Font font;
private final Scene scene;
private Group grid;
- public FontViewListener01(final int renderModes, final int graphSampleCount, final Font font, final char startCharSymbol) {
+ public FontViewListener01(final int renderModes, final int graphAAQuality, final int graphSampleCount, final Font font, final char startCharSymbol) {
this.renderModes = renderModes;
+ this.graphAAQuality = Region.clipAAQuality(graphAAQuality);
this.startCharSymbol = startCharSymbol;
this.font = font;
@@ -136,6 +139,7 @@ public class FontViewListener01 implements GLEventListener {
grid = new Group(new GridLayout(gridCols, netGridSize, netGridSize, Alignment.FillCenter, new Gap(netGridSize/0.90f*0.10f)));
scene.addShape(grid);
+ scene.setAAQuality(graphAAQuality);
for(int idx=0; idx<Character.MAX_VALUE && grid.getShapeCount() < cellCount ; ++idx) {
final char codepoint = (char)(startCharSymbol+idx);
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 4c8d98611..eba3ecec6 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java
@@ -52,15 +52,16 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
final int shape_ctor_mode;
OutlineShape outlineShape = null;
- public GPURegionGLListener01 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
- this(1, renderModes, sampleCount, debug, trace);
+ public GPURegionGLListener01 (final int renderModes, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) {
+ this(1, renderModes, aaQuality, sampleCount, debug, trace);
}
- public GPURegionGLListener01 (final int shape_ctor_mode, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
+ public GPURegionGLListener01 (final int shape_ctor_mode, 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.shape_ctor_mode = shape_ctor_mode;
this.getRenderer().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
setMatrix(-20, 00, -50, 0f, sampleCount);
+ setAAQuality(aaQuality);
}
private void createTestOutline00(){
@@ -290,7 +291,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount());
+ region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
regionRenderer.enable(gl, false);
}
}
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 d256424e5..dc2fa4df0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java
@@ -50,10 +50,11 @@ import com.jogamp.graph.curve.opengl.RegionRenderer;
public class GPURegionGLListener10 extends GPURendererListenerBase01 {
List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>();
- public GPURegionGLListener10 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) {
+ 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);
}
private void createTestOutline(final GLProfile glp){
@@ -130,7 +131,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 {
regionRenderer.setWeight(weight);
}
regionRenderer.enable(gl, true);
- region.draw(gl, regionRenderer, Region.MAX_AA_QUALITY, getSampleCount());
+ region.draw(gl, regionRenderer, getAAQuality(), getSampleCount());
regionRenderer.enable(gl, false);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
index 2eac05555..48f8d8a65 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2010-2024 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:
@@ -90,6 +90,7 @@ 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;
@@ -114,12 +115,15 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
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) {
this.xTran = xtrans;
this.yTran = ytrans;
this.zTran = zTran;
this.ang = angle;
- this.sampleCount[0] = sampleCount;
+ this.sampleCount[0] = Region.clipAASampleCount(sampleCount);
}
@Override
@@ -239,7 +243,7 @@ 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("_q%01d_s%02d-%s-Z%04d-snap%02d-%03dx%03d", graphAAQuality, sampleCount[0], 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));
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 32db14340..c3bff3408 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-2023 JogAmp Community. All rights reserved.
+ * Copyright 2010-2024 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:
@@ -148,7 +148,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
Window upstream_window = null;
StringBuilder userString = new StringBuilder(textX1);
boolean userInput = false;
- public GPUTextRendererListenerBase01(final GLProfile glp, 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 aaQuality, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) {
// NOTE_ALPHA_BLENDING: We use alpha-blending
super(RegionRenderer.create(blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null),
renderModes, debug, trace);
@@ -159,6 +159,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
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);
}
void switchHeadBox() {
@@ -323,7 +324,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
lfps = 0f;
tfps = 0f;
}
- final String modeS = Region.getRenderModeString(regionFPS.getRenderModes());
+ 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",
lfps, tfps, gl.getSwapInterval(), dpiV, ppmmV,
fontSizeHead, pixelSizeHead, mmSizeHead,
@@ -339,7 +340,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, sampleCountFPS, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionFPS.clear(gl), renderer, font, text, null, getAAQuality(), sampleCountFPS, tempT1, tempT2);
pmv.popMv();
}
@@ -354,7 +355,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, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, fontName, null, getAAQuality(), getSampleCount());
pmv.popMv();
}
@@ -370,7 +371,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, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, headtext, null, getAAQuality(), getSampleCount());
pmv.popMv();
}
@@ -393,15 +394,15 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
}
if(!userInput) {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, text2, null, getAAQuality(), getSampleCount(), tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, text2, null, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, text2, null, getAAQuality(), getSampleCount());
}
} else {
if( bottomTextUseFrustum ) {
- TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getSampleCount(), tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, regionBottom.clear(gl), renderer, font, userString.toString(), null, getAAQuality(), getSampleCount(), tempT1, tempT2);
} else {
- textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getSampleCount());
+ textRegionUtil.drawString3D(gl, renderer, font, userString.toString(), null, getAAQuality(), getSampleCount());
}
}
pmv.popMv();
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 b2adf26c3..4f2161c7d 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/PerfTextRendererNEWT00.java
@@ -308,7 +308,7 @@ public class PerfTextRendererNEWT00 {
pmv.loadMvIdentity();
pmv.translateMv(dx, dy, z0);
pmv.scaleMv(fontScale, fontScale, 1f);
- region.draw(gl, renderer, Region.MAX_AA_QUALITY, sampleCountIO);
+ region.draw(gl, renderer, Region.DEFAULT_AA_QUALITY, sampleCountIO);
final long t5 = Clock.currentNanos(); // text added to region
if( null != perf ) {
final long td_graph = t3 - t2;
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 c19cec993..8d7fdb852 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011-2023 JogAmp Community. All rights reserved.
+ * Copyright 2011-2024 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:
@@ -85,7 +85,7 @@ public class TestRegionRendererNEWT01 extends UITestCase {
final GLWindow window = createWindow("t00-shape-vbaa0-msaa0", caps, 800, 400);
- final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false);
+ final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, Region.DEFAULT_AA_QUALITY, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
@@ -118,7 +118,7 @@ public class TestRegionRendererNEWT01 extends UITestCase {
final GLWindow window = createWindow("t01-shape-vbaa0-msaa0", caps, 800, 400);
- final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
+ final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
@@ -148,7 +148,7 @@ public class TestRegionRendererNEWT01 extends UITestCase {
final GLWindow window = createWindow("t10-shape-vbaa0-msaa1", caps, 800, 400);
- final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, 0, false, false);
+ final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (0, Region.DEFAULT_AA_QUALITY, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
@@ -183,7 +183,7 @@ public class TestRegionRendererNEWT01 extends UITestCase {
final GLWindow window = createWindow("t11-shape-vbaa0-msaa1", caps, 800, 400);
- final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
+ final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.VARWEIGHT_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
@@ -216,7 +216,7 @@ public class TestRegionRendererNEWT01 extends UITestCase {
caps.setAlphaBits(4);
final GLWindow window = createWindow("t20-shape-vbaa1-msaa0", caps, 800,400);
- final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (Region.VBAA_RENDERING_BIT, 4, false, false);
+ final GPURegionGLListener10 demo02Listener = new GPURegionGLListener10 (Region.VBAA_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 4, false, false);
demo02Listener.attachInputListenerTo(window);
window.addGLEventListener(demo02Listener);
@@ -238,7 +238,7 @@ 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 GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, 0, 0, false, false);
+ final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (shape_ctor_mode, 0, Region.DEFAULT_AA_QUALITY, 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 9572b5d6f..3a2aa47a2 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011-2023 JogAmp Community. All rights reserved.
+ * Copyright 2011-2024 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:
@@ -256,7 +256,7 @@ public class TestTextRendererNEWT01 extends UITestCase {
pmv.loadMvIdentity();
pmv.translateMv(dx, dy, z0);
pmv.scaleMv(fontSize, fontSize, 1.0f);
- textRenderUtil.drawString3D(gl, renderer, font, text, null, sampleCount);
+ textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, sampleCount);
lastRow = row;
}
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 5ce4005a6..24fcbb70f 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT20.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011-2023 JogAmp Community. All rights reserved.
+ * Copyright 2011-2024 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:
@@ -27,6 +27,7 @@
*/
package com.jogamp.opengl.test.junit.graph;
+import java.io.File;
import java.io.IOException;
import com.jogamp.opengl.GL;
@@ -69,6 +70,9 @@ public class TestTextRendererNEWT20 extends UITestCase {
static long duration = 100; // ms
static int win_width = 1024;
static int win_height = 640;
+ static Font[] fontSet = new Font[] { };
+ static int[] aaQualitySet = new int[] { 0, 1 };
+ static int[] sampleSet = new int[] { 1, 2, 4 };
static int atoi(final String a) {
try {
@@ -87,8 +91,20 @@ public class TestTextRendererNEWT20 extends UITestCase {
} else if(args[i].equals("-height")) {
i++;
win_height = atoi(args[i]);
+ } else if(args[i].equals("-font")) {
+ i++;
+ fontSet = new Font[] { FontFactory.get(new File(args[i])) };
+ } else if(args[i].equals("-samples")) {
+ i++;
+ sampleSet = new int[] { atoi(args[i]) };
+ } else if(args[i].equals("-aaq")) {
+ i++;
+ aaQualitySet = new int[] { atoi(args[i]) };
}
}
+ if( 0 == fontSet.length ) {
+ fontSet = FontSet01.getSet01();
+ }
final String tstname = TestTextRendererNEWT20.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
@@ -143,7 +159,7 @@ public class TestTextRendererNEWT20 extends UITestCase {
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString());
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final TextGLListener textGLListener = new TextGLListener(glp, Region.VBAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE);
+ final TextGLListener textGLListener = new TextGLListener(glp, Region.VBAA_RENDERING_BIT, Region.DEFAULT_AA_QUALITY, 4 /* sampleCount */, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
textGLListener.setHeadBox(2, true);
@@ -155,22 +171,25 @@ public class TestTextRendererNEWT20 extends UITestCase {
@Override
public void run() {
textGLListener.setHeadBox(1, false);
- textGLListener.setSampleCount(4);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
textGLListener.setHeadBox(2, false);
- textGLListener.setSampleCount(4);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
} };
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
+ for(final Font f : fontSet) {
if( textGLListener.setFont(f) ) {
- action_per_font.run();
+ for(final int aaQuality : aaQualitySet ) {
+ textGLListener.setAAQuality(aaQuality);
+ for(final int sampleCount : sampleSet ) {
+ textGLListener.setSampleCount(sampleCount);
+ action_per_font.run();
+ }
+ }
}
}
if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
@@ -196,7 +215,7 @@ public class TestTextRendererNEWT20 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final TextGLListener textGLListener = new TextGLListener(glp, Region.MSAA_RENDERING_BIT, 4 /* sampleCount */, DEBUG, TRACE);
+ final TextGLListener textGLListener = new TextGLListener(glp, Region.MSAA_RENDERING_BIT, -1, 4 /* sampleCount */, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
textGLListener.setHeadBox(2, true);
@@ -208,22 +227,22 @@ public class TestTextRendererNEWT20 extends UITestCase {
@Override
public void run() {
textGLListener.setHeadBox(1, false);
- textGLListener.setSampleCount(4);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
textGLListener.setHeadBox(2, false);
- textGLListener.setSampleCount(4);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
} };
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
+ for(final Font f : fontSet) {
if( textGLListener.setFont(f) ) {
- action_per_font.run();
+ for(final int sampleCount : sampleSet ) {
+ textGLListener.setSampleCount(sampleCount);
+ action_per_font.run();
+ }
}
}
if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
@@ -245,7 +264,7 @@ public class TestTextRendererNEWT20 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE);
+ final TextGLListener textGLListener = new TextGLListener(glp, Region.NORM_RENDERING_BIT, -1, 0 /* sampleCount */, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
textGLListener.setHeadBox(2, true);
@@ -255,28 +274,21 @@ public class TestTextRendererNEWT20 extends UITestCase {
@Override
public void run() {
textGLListener.setHeadBox(1, false);
- textGLListener.setSampleCount(0);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
textGLListener.setHeadBox(2, false);
- textGLListener.setSampleCount(0);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
} };
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
+ for(final Font f : fontSet) {
if( textGLListener.setFont(f) ) {
action_per_font.run();
}
}
- if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
- action_per_font.run();
- }
-
destroyWindow(window);
}
@@ -291,7 +303,7 @@ public class TestTextRendererNEWT20 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final TextGLListener textGLListener = new TextGLListener(glp, 0, 0 /* sampleCount */, DEBUG, TRACE);
+ final TextGLListener textGLListener = new TextGLListener(glp, Region.NORM_RENDERING_BIT, -1, 0 /* sampleCount */, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
textGLListener.setHeadBox(2, true);
@@ -301,34 +313,27 @@ public class TestTextRendererNEWT20 extends UITestCase {
@Override
public void run() {
textGLListener.setHeadBox(1, false);
- textGLListener.setSampleCount(0);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
textGLListener.setHeadBox(2, false);
- textGLListener.setSampleCount(0);
window.display();
textGLListener.printScreenOnGLThread(window, "./", window.getTitle(), "", false);
sleep();
} };
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
+ for(final Font f : fontSet) {
if( textGLListener.setFont(f) ) {
action_per_font.run();
}
}
- if(textGLListener.setFontSet(FontFactory.JAVA, 0, 0)) {
- action_per_font.run();
- }
-
destroyWindow(window);
}
private static class TextGLListener extends GPUTextRendererListenerBase01 {
- public TextGLListener(final GLProfile glp, final int type, final int sampleCount, final boolean debug, final boolean trace) {
- super(glp, type, sampleCount, true, debug, trace);
+ public TextGLListener(final GLProfile glp, final int type, final int aaQuality, final int sampleCount, final boolean debug, final boolean trace) {
+ super(glp, type, aaQuality, sampleCount, true, debug, trace);
}
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java
index a3d88e1ba..6a1e92baf 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT21.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2023 JogAmp Community. All rights reserved.
+ * Copyright 2023-2024 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:
@@ -27,16 +27,13 @@
*/
package com.jogamp.opengl.test.junit.graph;
+import java.io.File;
import java.io.IOException;
-import com.jogamp.opengl.GL;
-import com.jogamp.opengl.GL2ES2;
-import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
-import com.jogamp.opengl.JoglVersion;
import jogamp.common.os.PlatformPropsImpl;
@@ -48,7 +45,6 @@ import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionUtil;
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.newt.opengl.GLWindow;
@@ -69,6 +65,9 @@ public class TestTextRendererNEWT21 extends UITestCase {
static long duration = 100; // ms
static int win_width = 1280;
static int win_height = 720;
+ static Font[] fontSet = new Font[] { };
+ static int[] aaQualitySet = new int[] { 0, 1 };
+ static int[] sampleSet = new int[] { 1, 2, 4 };
static boolean onlyOne = false;
static int atoi(final String a) {
@@ -90,8 +89,20 @@ public class TestTextRendererNEWT21 extends UITestCase {
} else if(args[i].equals("-height")) {
i++;
win_height = atoi(args[i]);
+ } else if(args[i].equals("-font")) {
+ i++;
+ fontSet = new Font[] { FontFactory.get(new File(args[i])) };
+ } else if(args[i].equals("-samples")) {
+ i++;
+ sampleSet = new int[] { atoi(args[i]) };
+ } else if(args[i].equals("-aaq")) {
+ i++;
+ aaQualitySet = new int[] { atoi(args[i]) };
}
}
+ if( 0 == fontSet.length ) {
+ fontSet = FontSet01.getSet01();
+ }
final String tstname = TestTextRendererNEWT21.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
@@ -130,13 +141,15 @@ public class TestTextRendererNEWT21 extends UITestCase {
class TestAction implements Runnable {
private final GLWindow window;
private final int renderModes;
+ private final int graphAAQuality;
private final int graphSampleCount;
private final Font font;
private boolean keepAlive = false;
- public TestAction(final GLWindow window, final int renderModes, final int graphSampleCount, final Font font) {
+ public TestAction(final GLWindow window, final int renderModes, final int graphAAQuality, final int graphSampleCount, final Font font) {
this.window = window;
this.renderModes = renderModes;
+ this.graphAAQuality = graphAAQuality;
this.graphSampleCount = graphSampleCount;
this.font = font;
}
@@ -147,9 +160,9 @@ public class TestTextRendererNEWT21 extends UITestCase {
final int fsaaSampleCount = window.getChosenGLCapabilities().getNumSamples();
if( null != font ) {
System.err.printf("Test Run: %s, %s%n",
- Region.getRenderModeString(renderModes, graphSampleCount, fsaaSampleCount),
+ Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount),
font.getFullFamilyName());
- final FontViewListener01 glel = new FontViewListener01(renderModes, graphSampleCount, font, '!' /* startCharSymbol */);
+ final FontViewListener01 glel = new FontViewListener01(renderModes, graphAAQuality, graphSampleCount, font, '!' /* startCharSymbol */);
glel.attachInputListenerTo(window);
window.addGLEventListener(glel);
window.display();
@@ -160,7 +173,7 @@ public class TestTextRendererNEWT21 extends UITestCase {
}
} else {
System.err.printf("Test Skipped: %s, %s, font not available%n",
- Region.getRenderModeString(renderModes, graphSampleCount, fsaaSampleCount),
+ Region.getRenderModeString(renderModes, 0, graphSampleCount, fsaaSampleCount),
font.getFullFamilyName());
}
}
@@ -184,8 +197,7 @@ public class TestTextRendererNEWT21 extends UITestCase {
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString());
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final int graphSampleCount = 4;
- final TestAction ta = new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, FontSet01.getSet01()[0]);
+ final TestAction ta = new TestAction(window, Region.VBAA_RENDERING_BIT, aaQualitySet[0], sampleSet[0], fontSet[0]);
ta.setKeepAlive(true);
ta.run();
}
@@ -209,15 +221,12 @@ public class TestTextRendererNEWT21 extends UITestCase {
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(window.getScreen().getDisplay().getGraphicsDevice(), null).toString());
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final int graphSampleCount = 4;
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
- new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, f).run();
- }
- try {
- new TestAction(window, Region.VBAA_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run();
- } catch(final IOException ioe) {
- System.err.println("Caught: "+ioe.getMessage());
+ for(final Font f : fontSet) {
+ for(final int aaQuality : aaQualitySet ) {
+ for(final int sampleCount : sampleSet ) {
+ new TestAction(window, Region.VBAA_RENDERING_BIT, aaQuality, sampleCount, f).run();
+ }
+ }
}
destroyWindow(window);
}
@@ -239,15 +248,10 @@ public class TestTextRendererNEWT21 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final int graphSampleCount = 4;
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
- new TestAction(window, Region.MSAA_RENDERING_BIT, graphSampleCount, f).run();
- }
- try {
- new TestAction(window, Region.MSAA_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run();
- } catch(final IOException ioe) {
- System.err.println("Caught: "+ioe.getMessage());
+ for(final Font f : fontSet) {
+ for(final int sampleCount : sampleSet ) {
+ new TestAction(window, Region.MSAA_RENDERING_BIT, -1, sampleCount, f).run();
+ }
}
destroyWindow(window);
}
@@ -268,15 +272,8 @@ public class TestTextRendererNEWT21 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final int graphSampleCount = 0;
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
- new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, f).run();
- }
- try {
- new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run();
- } catch(final IOException ioe) {
- System.err.println("Caught: "+ioe.getMessage());
+ for(final Font f : fontSet) {
+ new TestAction(window, Region.NORM_RENDERING_BIT, -1, 0, f).run();
}
destroyWindow(window);
}
@@ -295,15 +292,8 @@ public class TestTextRendererNEWT21 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
- final int graphSampleCount = 0;
- final Font[] fonts = FontSet01.getSet01();
- for(final Font f : fonts) {
- new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, f).run();
- }
- try {
- new TestAction(window, Region.NORM_RENDERING_BIT, graphSampleCount, FontFactory.get(FontFactory.JAVA).get(0 /* family */, 0 /* stylebits */)).run();
- } catch(final IOException ioe) {
- System.err.println("Caught: "+ioe.getMessage());
+ for(final Font f : fontSet) {
+ new TestAction(window, Region.NORM_RENDERING_BIT, -1, 0, f).run();
}
destroyWindow(window);
}
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 79d50b43e..b5b8b1820 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-2023 JogAmp Community. All rights reserved.
+ * Copyright 2012-2024 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:
@@ -201,7 +201,7 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase {
final float sxy = fontSize / font.getMetrics().getUnitsPerEM();
pmv.scaleMv(sxy, sxy, 1.0f);
}
- textRenderUtil.drawString3D(gl, renderer, font, text, null, sampleCount);
+ textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, sampleCount);
lastRow = row;
}
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 8b1964388..73dfb716c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2014 JogAmp Community. All rights reserved.
+ * Copyright 2014-2024 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,7 +32,7 @@ import java.io.IOException;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLEventListener;
-
+import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -258,11 +258,11 @@ public abstract class TextRendererGLELBase implements GLEventListener {
}
renderer.enable(gl, true);
if( cacheRegion ) {
- textRenderUtil.drawString3D(gl, renderer, font, text, null, vbaaSampleCount);
+ textRenderUtil.drawString3D(gl, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount);
} else if( null != region ) {
- TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, region, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
} else {
- TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, vbaaSampleCount, tempT1, tempT2);
+ TextRegionUtil.drawString3D(gl, renderModes, renderer, font, text, null, Region.DEFAULT_AA_QUALITY, vbaaSampleCount, tempT1, tempT2);
}
renderer.enable(gl, false);