aboutsummaryrefslogtreecommitdiffstats
path: root/src/demos/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-03 02:30:07 +0200
committerSven Gothel <[email protected]>2023-09-03 02:30:07 +0200
commitc059585e246ed707ba490f9d2bae3a8b90e949a7 (patch)
tree61349e65c273e16a0f0a0a31998f28a968c81d36 /src/demos/com/jogamp/opengl
parentef63d2e288fe47762d9cf743d11cd01f8d255349 (diff)
GraphUI Scene: Pass sampleCount in ctor variant and refine API doc, clip to [1..8]; Add clarity in Region; Demos CommandlineOptions adds actual graphAASamples set and utilized
Diffstat (limited to 'src/demos/com/jogamp/opengl')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java15
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java23
10 files changed, 34 insertions, 20 deletions
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 dcc1102ed..7af28ca23 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -144,7 +144,7 @@ public class FontView01 {
});
animator.add(window);
- final Scene scene = new Scene();
+ 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.setFrustumCullingEnabled(true);
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 6c424d42c..d515896b8 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -184,7 +184,7 @@ public class UIGraphDemoU01a {
/** World origin (bottom left) offset. */
private final Vec3f worldOrigin = new Vec3f();
/** Sample count for Graph-VBAA */
- private final int[] sampleCount = { 4 };
+ private final int[] sampleCount = { options.graphAASamples };
/** Graph region renderer */
private final RegionRenderer renderer;
/** The Graph region for text */
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 e0ffb9663..ddc1b72f6 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java
@@ -75,7 +75,7 @@ public class UISceneDemo00 {
final Shape 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();
+ 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);
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 8bdb3eb47..5aa5869cd 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
@@ -83,7 +83,7 @@ public class UISceneDemo01 {
System.err.println("Shape bounds "+shape.getBounds(reqGLP));
System.err.println("Shape "+shape);
- final Scene scene = new Scene();
+ 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.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.addShape(shape);
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 4a564ef42..37ecac50c 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
@@ -91,7 +91,7 @@ public class UISceneDemo01b {
System.err.println("Shape bounds "+shape.getBounds(reqGLP));
System.err.println("Shape "+shape);
- final Scene scene = new Scene();
+ 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.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.addShape(shape);
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 449d6bd96..a670b02f8 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
@@ -58,6 +58,7 @@ import com.jogamp.opengl.util.PMVMatrix;
* </p>
* <p>
* Pass '-keep' to main-function to keep running.
+ * Pass '-auto' to main-function to keep running and change speed for each animation cycle
* </p>
*/
public class UISceneDemo02 {
@@ -65,10 +66,8 @@ public class UISceneDemo02 {
static float req_total_dur_s = 6f; // [s]
public static void main(final String[] args) throws IOException {
- boolean wait_to_start = false;
int autoSpeed = 0;
- boolean keepRunning = false;
if( 0 != args.length ) {
final int[] idx = { 0 };
for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
@@ -77,9 +76,7 @@ public class UISceneDemo02 {
} else if(args[idx[0]].equals("-aspeed")) {
autoSpeed = 1;
req_total_dur_s = 1f;
- keepRunning = true;
- } else if(args[idx[0]].equals("-wait")) {
- wait_to_start = true;
+ options.keepRunning = true;
}
}
}
@@ -99,7 +96,7 @@ public class UISceneDemo02 {
final Label movingGlyph = new Label(options.renderModes, font, "");
movingGlyph.setColor(0.1f, 0.1f, 0.1f, 1);
- final Scene scene = new Scene();
+ 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(destText);
scene.addShape(movingGlyph);
@@ -142,7 +139,7 @@ public class UISceneDemo02 {
final AABBox sceneBox = scene.getBounds();
System.err.println("SceneBox "+sceneBox);
- if( wait_to_start ) {
+ if( options.wait_to_start ) {
MiscUtils.waitForKey("Start");
}
@@ -293,8 +290,8 @@ public class UISceneDemo02 {
autoSpeed = 1;
}
}
- } while ( keepRunning && window.isNativeValid() );
- if( !keepRunning ) {
+ } while ( options.keepRunning && window.isNativeValid() );
+ if( !options.keepRunning ) {
window.destroy();
}
}
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 744ab1ea6..810fcdb87 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -182,7 +182,7 @@ public class UISceneDemo03 {
System.err.println("Font: " + font.getFullFamilyName());
final Font fontStatus = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf", FontSetDemos.class.getClassLoader(), FontSetDemos.class).getInputStream(), true);
- final Scene scene = new Scene();
+ 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.setPMVMatrixSetup( new MyPMVMatrixSetup(Scene.DEFAULT_SCENE_DIST) );
scene.setDebugBorderBox(options.debugBoxThickness);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
index 58e382c43..2459cbbf6 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
@@ -122,7 +122,7 @@ public class UISceneDemo10 {
System.err.println("m0 "+shape);
// Scene for Shape ...
- final Scene scene = new Scene();
+ 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);
shape.onMove(new Shape.Listener() {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java
index 474860532..79e8c8271 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java
@@ -96,7 +96,7 @@ public class UISceneDemo11 {
System.err.println("Group-A0 Layout "+groupA0.getLayout());
groupA0.forAll( (shape) -> { System.err.println("Shape... "+shape); return false; });
- final Scene scene = new Scene();
+ 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(groupA0);
scene.setFrustumCullingEnabled(true);
diff --git a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
index 0e0488ff1..21ea23a10 100644
--- a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
+++ b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
@@ -35,6 +35,8 @@ public class CommandlineOptions {
public String glProfileName = GLProfile.GL2ES2;
public int renderModes = Region.NORM_RENDERING_BIT;
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;
public float debugBoxThickness = 0f;
public boolean exclusiveContext = false;
public boolean wait_to_start = false;
@@ -46,10 +48,19 @@ public class CommandlineOptions {
GLProfile.initSingleton(); // ensure JOGL is completely initialized
}
+ /**
+ * Commandline options
+ * @param width viewport width in pixels
+ * @param height viewport height in pixels
+ * @param renderModes {@link Region#getRenderModes()}, if {@link Region#isGraphAA(int)} {@link #graphAASamples} is set to {@code 4}.
+ */
public CommandlineOptions(final int width, final int height, final int renderModes) {
this.surface_width = width;
this.surface_height = height;
this.renderModes = renderModes;
+ if( Region.isGraphAA(renderModes) ) {
+ this.graphAASamples = 4;
+ }
}
public void parse(final String[] args) {
final int[] idx = { 0 };
@@ -92,6 +103,7 @@ public class CommandlineOptions {
glProfileName = null;
} else if(args[idx[0]].equals("-gnone")) {
sceneMSAASamples = 0;
+ graphAASamples = 0;
renderModes = Region.NORM_RENDERING_BIT;
} else if(args[idx[0]].equals("-color")) {
renderModes |= Region.COLORCHANNEL_RENDERING_BIT;
@@ -99,15 +111,20 @@ public class CommandlineOptions {
renderModes &= ~Region.COLORCHANNEL_RENDERING_BIT;
} else if(args[idx[0]].equals("-smsaa")) {
++idx[0];
+ graphAASamples = 0;
sceneMSAASamples = MiscUtils.atoi(args[idx[0]], 4);
- renderModes &= ~(Region.VBAA_RENDERING_BIT | Region.MSAA_RENDERING_BIT );
+ renderModes &= ~Region.AA_RENDERING_MASK;
} else if(args[idx[0]].equals("-gmsaa")) {
+ ++idx[0];
sceneMSAASamples = 0;
- renderModes &= ~(Region.VBAA_RENDERING_BIT | Region.MSAA_RENDERING_BIT );
+ graphAASamples = MiscUtils.atoi(args[idx[0]], 4);
+ renderModes &= ~Region.AA_RENDERING_MASK;
renderModes |= Region.MSAA_RENDERING_BIT;
} else if(args[idx[0]].equals("-gvbaa")) {
+ ++idx[0];
sceneMSAASamples = 0;
- renderModes &= ~(Region.VBAA_RENDERING_BIT | Region.MSAA_RENDERING_BIT );
+ graphAASamples = MiscUtils.atoi(args[idx[0]], 4);
+ renderModes &= ~Region.AA_RENDERING_MASK;
renderModes |= Region.VBAA_RENDERING_BIT;
} else if (args[idx[0]].equals("-dbgbox")) {
++idx[0];