aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-08 13:37:16 +0100
committerSven Göthel <[email protected]>2024-01-08 13:37:16 +0100
commitcb50ca301d927683374212e8efe9818f53f818c1 (patch)
treeb4cc75df6eff2b6e2c0ea90aafb8b22b10709eed
parente6bbc1a93ff4925d2aae33de527353826f81bcf1 (diff)
GraphUI Demos: Have CommandlineOptions produce GLProfile and full GLCapabilities request, removing code duplication
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/GearsES2.java14
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/LandscapeES2.java14
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java13
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java30
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java12
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java26
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java39
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java42
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java18
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java18
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java13
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java13
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java9
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java14
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java18
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java17
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java10
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java29
-rw-r--r--src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java15
19 files changed, 128 insertions, 236 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java b/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java
index 7de905d02..8ca92775c 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java
@@ -46,7 +46,6 @@ import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAnimatorControl;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRendererQuirks;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.JoglVersion;
@@ -705,17 +704,10 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
System.err.println(VersionUtil.getPlatformInfo());
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(dpy.getGraphicsDevice(), null).toString());
- final GLProfile glp = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+glp);
- final GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
if( 0 == options.sceneMSAASamples ) {
window.setCapabilitiesChooser(new NonFSAAGLCapsChooser(false));
}
diff --git a/src/demos/com/jogamp/opengl/demos/es2/LandscapeES2.java b/src/demos/com/jogamp/opengl/demos/es2/LandscapeES2.java
index 9514e7146..b507fd3f4 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/LandscapeES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/LandscapeES2.java
@@ -44,7 +44,6 @@ import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.demos.util.CommandlineOptions;
@@ -205,17 +204,10 @@ public class LandscapeES2 implements GLEventListener {
System.err.println(VersionUtil.getPlatformInfo());
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(dpy.getGraphicsDevice(), null).toString());
- final GLProfile glp = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+glp);
- final GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
if( 0 == options.sceneMSAASamples ) {
window.setCapabilitiesChooser(new NonFSAAGLCapsChooser(false));
}
diff --git a/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java b/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
index 9b539ed61..12f1d5416 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
@@ -228,17 +228,10 @@ public class PointsDemoES2 extends PointsDemo {
System.err.println(VersionUtil.getPlatformInfo());
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(dpy.getGraphicsDevice(), null).toString());
- final GLProfile glp = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+glp);
- final GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
if( 0 == options.sceneMSAASamples ) {
window.setCapabilitiesChooser(new NonFSAAGLCapsChooser(false));
}
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 b7b5f3168..4946d7b84 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -132,20 +132,12 @@ public class FontView01 {
System.err.println("Status Font "+fontStatus.getFullFamilyName());
System.err.println("Info Font "+fontInfo.getFullFamilyName());
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
-
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1*60, null); // System.err);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(FontView01.class.getSimpleName()+": "+font.getFullFamilyName()+", "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
@@ -267,8 +259,8 @@ public class FontView01 {
glyphGrid = new Group(new GridLayout(gridDim.rawSize.x(), cellSize*0.9f, cellSize*0.9f, Alignment.FillCenter, new Gap(cellSize*0.1f)));
}
- addGlyphs(reqGLP, font, glyphGrid, gridDim, showUnderline[0], showLabel[0], fontStatus, fontInfo, glyphMouseListener);
- glyphGrid.validate(reqGLP);
+ addGlyphs(reqCaps.getGLProfile(), font, glyphGrid, gridDim, showUnderline[0], showLabel[0], fontStatus, fontInfo, glyphMouseListener);
+ glyphGrid.validate(reqCaps.getGLProfile());
System.err.println("GlyphGrid "+glyphGrid);
System.err.println("GlyphGrid "+glyphGrid.getLayout());
@@ -279,7 +271,7 @@ public class FontView01 {
infoGrid.addShape(glyphShapeBox.setBorder(0.005f).setBorderColor(0, 0, 0, 1));
infoGrid.addShape(glyphInfoBox.setBorder(0.005f).setBorderColor(0, 0, 0, 1));
if( VERBOSE_UI ) {
- infoGrid.validate(reqGLP);
+ infoGrid.validate(reqCaps.getGLProfile());
System.err.println("InfoGrid "+infoGrid);
System.err.println("InfoGrid "+infoGrid.getLayout());
}
@@ -317,7 +309,7 @@ public class FontView01 {
@Override
public boolean run(final GLAutoDrawable drawable) {
glyphGrid.removeAllShapes(drawable.getGL().getGL2ES2(), scene.getRenderer());
- addGlyphs(reqGLP, font, glyphGrid, gridDim, showUnderline[0], showLabel[0], fontStatus, fontInfo, glyphMouseListener);
+ addGlyphs(reqCaps.getGLProfile(), font, glyphGrid, gridDim, showUnderline[0], showLabel[0], fontStatus, fontInfo, glyphMouseListener);
if( VERBOSE_UI ) {
System.err.println("Slider: "+gridDim);
}
@@ -332,7 +324,7 @@ public class FontView01 {
glyphInfoGrid.addShape(rs2);
glyphInfoGrid.addShape(infoGrid);
if( VERBOSE_UI ) {
- glyphInfoGrid.validate(reqGLP);
+ glyphInfoGrid.validate(reqCaps.getGLProfile());
System.err.println("GlyphInfoGrid "+glyphInfoGrid);
System.err.println("GlyphInfoGrid "+glyphInfoGrid.getLayout());
}
@@ -349,7 +341,7 @@ public class FontView01 {
mainGrid.addShape(labelBox);
}
if( VERBOSE_UI ) {
- mainGrid.validate(reqGLP);
+ mainGrid.validate(reqCaps.getGLProfile());
System.err.println("MainGrid "+mainGrid);
System.err.println("MainGrid "+mainGrid.getLayout());
}
@@ -422,7 +414,7 @@ public class FontView01 {
}
void setStartRow(final int row) {
- final int old = start;
+ // final int old = start;
final int np = row * columns;
if( np < contourChars.size() - columns ) {
start = np;
@@ -468,7 +460,7 @@ public class FontView01 {
c2.addShape(c1);
{
final Label l = new Label(options.renderModes, fontInfo, 1f, fg.getName());
- final AABBox lbox = l.getUnscaledGlyphBounds();
+ // final AABBox lbox = l.getUnscaledGlyphBounds();
final float sxy = 1f/7f; // gridDim.maxNameLen; // 0.10f; // Math.min(sx, sy);
c2.addShape( l.scale(sxy, sxy, 1).setColor(0, 0, 0, 1).setInteractive(false).setDragAndResizeable(false) );
}
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 5048e911e..6235c481b 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -57,7 +57,6 @@ import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.opengl.demos.util.MiscUtils;
@@ -132,8 +131,9 @@ public class UIGraphDemoU01a {
System.err.println(options);
System.err.println("Ortho Projection "+projOrtho+", Ortho-Win "+projOrthoWin);
System.err.println("pass2TexUnit "+pass2TexUnit);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -143,13 +143,9 @@ public class UIGraphDemoU01a {
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
final MyRenderer renderer = new MyRenderer();
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UIGraphDemoU01a.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
index 4a07ef794..506ed09b6 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java
@@ -88,20 +88,12 @@ public class UILayoutBox01 {
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UILayoutBox01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.addWindowListener(new WindowAdapter() {
@@ -168,7 +160,7 @@ public class UILayoutBox01 {
//
//
//
- fillDemoScene(groups, reqGLP, scene, zEps, sxy, nextPos, cellGap,
+ fillDemoScene(groups, reqCaps.getGLProfile(), scene, zEps, sxy, nextPos, cellGap,
new Margin(0.04f, 0.04f, 0.10f, 0.10f),
new Padding(0.03f, 0.03f, 0.07f, 0.07f), font, dragZoomRotateListener);
@@ -179,7 +171,7 @@ public class UILayoutBox01 {
System.err.println("Group["+idx+"].2.0 "+g);
System.err.println("Group["+idx+"].2.0 "+g.getLayout());
g.markShapeDirty();
- g.validate(reqGLP);
+ g.validate(reqCaps.getGLProfile());
System.err.println("Group["+idx+"].2.1 "+g);
System.err.println("Group["+idx+"].2.1 "+g.getLayout());
++idx;
@@ -187,7 +179,7 @@ public class UILayoutBox01 {
}
try { Thread.sleep(1000); } catch (final InterruptedException e1) { }
- scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBox01.class.getSimpleName(), options.renderModes, caps, null));
+ scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBox01.class.getSimpleName(), options.renderModes, reqCaps, null));
{
int idx = 0;
for(final Group g : groups) {
@@ -207,7 +199,7 @@ public class UILayoutBox01 {
//
nextPos.set(0, 0, 0);
- fillDemoScene(groups, reqGLP, scene, zEps, sxy, nextPos, cellGap,
+ fillDemoScene(groups, reqCaps.getGLProfile(), scene, zEps, sxy, nextPos, cellGap,
new Margin(0.07f, 0.07f),
new Padding(0.10f, 0.10f), font, dragZoomRotateListener);
@@ -218,7 +210,7 @@ public class UILayoutBox01 {
System.err.println("Group["+idx+"].2.0 "+g);
System.err.println("Group["+idx+"].2.0 "+g.getLayout());
g.markShapeDirty();
- g.validate(reqGLP);
+ g.validate(reqCaps.getGLProfile());
System.err.println("Group["+idx+"].2.1 "+g);
System.err.println("Group["+idx+"].2.1 "+g.getLayout());
++idx;
@@ -226,7 +218,7 @@ public class UILayoutBox01 {
}
try { Thread.sleep(1000); } catch (final InterruptedException e1) { }
- scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBox01.class.getSimpleName(), options.renderModes, caps, null));
+ scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBox01.class.getSimpleName(), options.renderModes, reqCaps, null));
{
int idx = 0;
for(final Group g : groups) {
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
index 8261f6ec0..b3af0f9a5 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java
@@ -38,9 +38,7 @@ import com.jogamp.graph.ui.Scene;
import com.jogamp.graph.ui.Shape;
import com.jogamp.graph.ui.layout.Alignment;
import com.jogamp.graph.ui.layout.BoxLayout;
-import com.jogamp.graph.ui.layout.Gap;
import com.jogamp.graph.ui.layout.GridLayout;
-import com.jogamp.graph.ui.layout.Padding;
import com.jogamp.graph.ui.shapes.Label;
import com.jogamp.graph.ui.shapes.Rectangle;
import com.jogamp.math.FloatUtil;
@@ -48,7 +46,6 @@ import com.jogamp.math.Vec3f;
import com.jogamp.math.Vec4f;
import com.jogamp.math.geom.AABBox;
import com.jogamp.math.geom.plane.AffineTransform;
-import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
@@ -89,20 +86,12 @@ public class UILayoutBoxGridOffset01 {
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UILayoutBoxGridOffset01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.addWindowListener(new WindowAdapter() {
@@ -155,7 +144,7 @@ public class UILayoutBoxGridOffset01 {
final float minX = 0.00f, minY = 0.00f, width = 0.5f, height = 0.5f, lineWidth = 0.05f;
if( true ) {
final Group g = setupGroup(new Group(new BoxLayout(1f, 1f, Alignment.None)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 11,
(final Group gp) -> {
@@ -168,7 +157,7 @@ public class UILayoutBoxGridOffset01 {
final float minX = 0.125f, minY = 0.125f, width = 0.5f, height = 0.5f, lineWidth = 0.05f;
if( true ) {
final Group g = setupGroup(new Group(new BoxLayout(1f, 1f, Alignment.None)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 12,
(final Group gp) -> {
@@ -178,7 +167,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new BoxLayout(1f, 1f, Alignment.Fill)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 13,
(final Group gp) -> {
@@ -188,7 +177,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new BoxLayout(1f, 1f, Alignment.Center)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 14,
(final Group gp) -> {
@@ -198,7 +187,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new BoxLayout(1f, 1f, Alignment.FillCenter)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 15,
(final Group gp) -> {
@@ -218,7 +207,7 @@ public class UILayoutBoxGridOffset01 {
final float minX = 0.000f, minY = 0.000f, width = 0.5f, height = 0.5f, lineWidth = 0.05f;
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1f, Alignment.None)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 21,
(final Group gp) -> {
@@ -233,7 +222,7 @@ public class UILayoutBoxGridOffset01 {
final float minX = 0.125f, minY = 0.125f, width = 0.5f, height = 0.5f, lineWidth = 0.05f;
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1f, Alignment.None)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 22,
(final Group gp) -> {
@@ -245,7 +234,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1f, Alignment.Fill)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 23,
(final Group gp) -> {
@@ -257,7 +246,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1f, Alignment.Center)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 24,
(final Group gp) -> {
@@ -269,7 +258,7 @@ public class UILayoutBoxGridOffset01 {
}
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1f, Alignment.FillCenter)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGapX,
font, 25,
(final Group gp) -> {
@@ -299,7 +288,7 @@ public class UILayoutBoxGridOffset01 {
}
try { Thread.sleep(1000); } catch (final InterruptedException e1) { }
- scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBoxGridOffset01.class.getSimpleName(), options.renderModes, caps, null));
+ scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutBoxGridOffset01.class.getSimpleName(), options.renderModes, reqCaps, null));
if( !options.stayOpen ) {
window.destroy();
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
index 4221e022d..09ce93577 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java
@@ -87,20 +87,12 @@ public class UILayoutGrid01 {
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UILayoutGrid01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.addWindowListener(new WindowAdapter() {
@@ -166,7 +158,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(1, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 11,
(final Group gp) -> {
@@ -177,7 +169,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(1, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 12,
(final Group gp) -> {
@@ -189,7 +181,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(1f, 1/2f, Alignment.Fill, new Gap(0.10f), 1)),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 13,
(final Group gp) -> {
@@ -201,7 +193,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 14,
(final Group gp) -> {
@@ -215,7 +207,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 15,
(final Group gp) -> {
@@ -230,7 +222,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.Fill, new Gap(0.10f), new Padding(0.05f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 16,
(final Group gp) -> {
@@ -250,7 +242,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.Fill, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 21,
(final Group gp) -> {
@@ -265,7 +257,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.FillCenter, new Gap(0.10f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 22,
(final Group gp) -> {
@@ -280,7 +272,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, Alignment.FillCenter, new Gap(0.10f), new Padding(0.05f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 23,
(final Group gp) -> {
@@ -297,7 +289,7 @@ public class UILayoutGrid01 {
final float bw = 0.5f, bh = bw/2f;
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, new Alignment(Alignment.Bit.CenterHoriz.value),
new Gap(0.10f), new Padding(0.05f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 24,
(final Group gp) -> {
@@ -313,7 +305,7 @@ public class UILayoutGrid01 {
final float bw = 0.5f, bh = bw/2f;
final Group g = setupGroup(new Group(new GridLayout(2, 1f, 1/2f, new Alignment(Alignment.Bit.CenterVert.value),
new Gap(0.10f), new Padding(0.05f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 25,
(final Group gp) -> {
@@ -331,7 +323,7 @@ public class UILayoutGrid01 {
if( true ) {
final Group g = setupGroup(new Group(new GridLayout(2, 0, 0, Alignment.Fill, new Gap(0.03f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
2*sxy, nextPos, cellGap,
font, 31,
(final Group gp) -> {
@@ -362,7 +354,7 @@ public class UILayoutGrid01 {
if( true ) {
final float bw = 0.5f, bh = bw/2f;
final Group g = setupGroup(new Group(new GridLayout(2, 1, 1/2f, Alignment.Center, new Gap(0.10f), new Padding(0.05f))),
- reqGLP, scene, zEps,
+ reqCaps.getGLProfile(), scene, zEps,
sxy, nextPos, cellGap,
font, 32,
(final Group gp) -> {
@@ -387,7 +379,7 @@ public class UILayoutGrid01 {
}
try { Thread.sleep(1000); } catch (final InterruptedException e1) { }
- scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutGrid01.class.getSimpleName(), options.renderModes, caps, null));
+ scene.screenshot(true, scene.nextScreenshotFile(null, UILayoutGrid01.class.getSimpleName(), options.renderModes, reqCaps, null));
if( !options.stayOpen ) {
window.destroy();
}
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java
index bc0608b28..77becfdfb 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java
@@ -101,20 +101,12 @@ public class UIMediaGrid00 {
}
final Vec2i gridDim = new Vec2i(4, mediaFiles.size());
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
-
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1*60, null); // System.err);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setVisible(true);
window.setTitle(UIMediaGrid00.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
@@ -154,8 +146,8 @@ public class UIMediaGrid00 {
mediaGrid.setName("MediaGrid");
mediaGrid.setRelayoutOnDirtyShapes(false);
}
- addMedia(scene, reqGLP, mediaGrid, mediaFiles);
- mediaGrid.validate(reqGLP);
+ addMedia(scene, reqCaps.getGLProfile(), mediaGrid, mediaFiles);
+ mediaGrid.validate(reqCaps.getGLProfile());
System.err.println("MediaGrid "+mediaGrid);
System.err.println("MediaGrid "+mediaGrid.getLayout());
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
index 81d0aa549..158cde085 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
@@ -163,20 +163,12 @@ public class UIMediaGrid01 {
System.err.println("Media files: Count "+mediaFiles.size()+", grid "+gridDim);
}
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
-
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1*60, null); // System.err);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setVisible(true);
window.setTitle(UIMediaGrid01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
@@ -216,8 +208,8 @@ public class UIMediaGrid01 {
mediaGrid.setRelayoutOnDirtyShapes(false);
}
mediaGrid.setName("MediaGrid");
- addMedia(scene, reqGLP, mediaGrid, mediaFiles, boxRatio);
- mediaGrid.validate(reqGLP);
+ addMedia(scene, reqCaps.getGLProfile(), mediaGrid, mediaFiles, boxRatio);
+ mediaGrid.validate(reqCaps.getGLProfile());
System.err.println("MediaGrid "+mediaGrid);
System.err.println("MediaGrid "+mediaGrid.getLayout());
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 3f0bbce1c..3aa2b6551 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
@@ -46,7 +46,6 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLCapabilities;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.demos.es2.GearsES2;
import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.opengl.util.Animator;
@@ -68,8 +67,8 @@ public class UISceneDemo01 {
public static void main(final String[] args) throws IOException {
options.parse(args);
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -78,7 +77,7 @@ public class UISceneDemo01 {
System.err.println("Font: "+font.getFullFamilyName());
final Shape shape = makeShape(font, options.renderModes);
- System.err.println("Shape bounds "+shape.getBounds(reqGLP));
+ System.err.println("Shape bounds "+shape.getBounds(reqCaps.getGLProfile()));
System.err.println("Shape "+shape);
final Scene scene = new Scene(options.graphAASamples);
@@ -88,11 +87,7 @@ public class UISceneDemo01 {
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
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 987908624..e723d48ba 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java
@@ -47,7 +47,6 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLCapabilities;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.opengl.util.Animator;
@@ -68,8 +67,8 @@ public class UISceneDemo01b {
public static void main(final String[] args) throws IOException {
options.parse(args);
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -80,7 +79,7 @@ public class UISceneDemo01b {
final Shape shape = new Button(options.renderModes, font, "L", 1/8f, 1/8f/2.5f).setPerp(); // normalized: 1 is 100% surface size (width and/or height)
shape.getRotation().rotateByAngleX(FloatUtil.PI);
shape.getRotation().rotateByAngleY(FloatUtil.PI);
- System.err.println("Shape bounds "+shape.getBounds(reqGLP));
+ System.err.println("Shape bounds "+shape.getBounds(reqCaps.getGLProfile()));
System.err.println("Shape "+shape);
final Scene scene = new Scene(options.graphAASamples);
@@ -89,11 +88,7 @@ public class UISceneDemo01b {
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo01b.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
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 3e5ee2171..b6d785733 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo02.java
@@ -81,7 +81,8 @@ public class UISceneDemo02 {
}
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -104,11 +105,7 @@ public class UISceneDemo02 {
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1*60, null); // System.err);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo02.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
index a520711de..e2680f976 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java
@@ -168,8 +168,8 @@ public class UISceneDemo03 {
// renderModes |= Region.COLORCHANNEL_RENDERING_BIT;
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -192,15 +192,7 @@ public class UISceneDemo03 {
final Animator animator = new Animator(0 /* w/o AWT */);
animator.setUpdateFPSFrames(1 * 60, null); // System.err);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo03.class.getSimpleName() + ": " + window.getSurfaceWidth() + " x " + window.getSurfaceHeight());
window.setVisible(true);
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 9d7a2cc87..d28665d42 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
@@ -57,7 +57,6 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.demos.es2.GearsES2;
import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.opengl.util.Animator;
@@ -98,17 +97,10 @@ public class UISceneDemo10 {
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
//
// Resolution independent, no screen size
@@ -118,7 +110,7 @@ public class UISceneDemo10 {
}
System.err.println("Font: "+font.getFullFamilyName());
final Shape shape = makeShape(window, font, options.renderModes);
- System.err.println("m0 shape bounds "+shape.getBounds(reqGLP));
+ System.err.println("m0 shape bounds "+shape.getBounds(reqCaps.getGLProfile()));
System.err.println("m0 "+shape);
// Scene for Shape ...
@@ -126,7 +118,7 @@ public class UISceneDemo10 {
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- shape.onMove((final Shape s, final Vec3f origin, Vec3f dest) -> {
+ shape.onMove((final Shape s, final Vec3f origin, final Vec3f dest) -> {
final Vec3f p = shape.getPosition();
System.err.println("Shape moved: "+origin+" -> "+p);
} );
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 140ce2e3a..c5df5e5ef 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java
@@ -49,7 +49,6 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLCapabilities;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.opengl.util.Animator;
@@ -74,8 +73,8 @@ public class UISceneDemo11 {
}
System.err.println(options);
- final GLProfile reqGLP = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+reqGLP);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
//
// Resolution independent, no screen size
@@ -92,7 +91,7 @@ public class UISceneDemo11 {
}
groupA0.setInteractive(true);
groupA0.scale(1/8f, 1/8f, 1);
- groupA0.validate(reqGLP);
+ groupA0.validate(reqCaps.getGLProfile());
System.err.println("Group-A0 "+groupA0);
System.err.println("Group-A0 Layout "+groupA0.getLayout());
groupA0.forAll( (shape) -> { System.err.println("Shape... "+shape); return false; });
@@ -105,15 +104,7 @@ public class UISceneDemo11 {
final Animator animator = new Animator(0 /* w/o AWT */);
- final GLCapabilities caps = new GLCapabilities(reqGLP);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo11.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
window.setVisible(true);
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 ef45465cd..20642d737 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -82,7 +82,6 @@ import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLPipelineFactory;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRunnable;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.demos.es2.GearsES2;
@@ -150,14 +149,7 @@ public class UISceneDemo20 implements GLEventListener {
System.err.println(VersionUtil.getPlatformInfo());
// System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(dpy.getGraphicsDevice(), null).toString());
- final GLProfile glp = GLProfile.get(options.glProfileName);
- System.err.println("GLProfile: "+glp);
- final GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- if( options.sceneMSAASamples > 0 ) {
- caps.setSampleBuffers(true);
- caps.setNumSamples(options.sceneMSAASamples);
- }
+ final GLCapabilities caps = options.getGLCaps();
System.out.println("Requested: " + caps);
final GLWindow window = GLWindow.create(screen, caps);
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 a7909a169..bfb122ce0 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
@@ -39,9 +39,9 @@ import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLPipelineFactory;
-import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRunnable;
import com.jogamp.opengl.demos.graph.MSAATool;
+import com.jogamp.opengl.demos.util.CommandlineOptions;
import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -86,32 +86,33 @@ public class UIShapeDemo01 implements GLEventListener {
static final boolean DEBUG = false;
static final boolean TRACE = false;
+ static CommandlineOptions options = new CommandlineOptions(1280, 720, Region.VBAA_RENDERING_BIT);
+
public static void main(final String[] args) throws IOException {
Font font = null;
- final int width = 1280, height = 720;
- if( 0 != args.length ) {
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-font")) {
- i++;
- font = FontFactory.get(new File(args[i]));
- }
+ final int[] idx = { 0 };
+ for (idx[0] = 0; idx[0] < args.length; ++idx[0]) {
+ if( options.parse(args, idx) ) {
+ continue;
+ } else if(args[idx[0]].equals("-font")) {
+ idx[0]++;
+ font = FontFactory.get(new File(args[idx[0]]));
}
}
+ System.err.println(options);
if( null == font ) {
font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF);
}
System.err.println("Font: "+font.getFullFamilyName());
- final GLProfile glp = GLProfile.getGL2ES2();
- final GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
+ final GLCapabilities reqCaps = options.getGLCaps();
+ System.out.println("Requested: " + reqCaps);
final int renderModes = Region.VBAA_RENDERING_BIT;
- final GLWindow window = GLWindow.create(caps);
+ final GLWindow window = GLWindow.create(reqCaps);
// window.setPosition(10, 10);
- window.setSize(width, height);
+ window.setSize(options.surface_width, options.surface_height);
window.setTitle(UIShapeDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
final UIShapeDemo01 uiGLListener = new UIShapeDemo01(font, renderModes, DEBUG, TRACE);
uiGLListener.attachInputListenerTo(window);
diff --git a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
index 9eeb01f45..d4d414252 100644
--- a/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
+++ b/src/demos/com/jogamp/opengl/demos/util/CommandlineOptions.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.demos.util;
import com.jogamp.graph.curve.Region;
+import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
public class CommandlineOptions {
@@ -142,6 +143,20 @@ public class CommandlineOptions {
}
return res;
}
+ public GLProfile getGLProfile() {
+ return GLProfile.get(glProfileName);
+ }
+ public GLCapabilities getGLCaps() {
+ final GLProfile glp = getGLProfile();
+ final GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
+ if( sceneMSAASamples > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(sceneMSAASamples);
+ }
+ return caps;
+ }
+
@Override
public String toString() {
return "Options{surface[width "+surface_width+" x "+surface_height+"], glp "+glProfileName+