diff options
author | Sven Gothel <[email protected]> | 2014-05-27 23:45:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-27 23:45:52 +0200 |
commit | c142f237d171e1cd16918a2f897447444a709b56 (patch) | |
tree | 0f40edc26ad3e9630653b68b585581cf393b37a9 | |
parent | 8b255eb303bba045b4eb087da1d1cb33b2e89e96 (diff) |
GraphUI: Fix label layout (absolute), add auto no-aa dpi threshold (200 dpi), add all modes to applet test-page
10 files changed, 328 insertions, 36 deletions
diff --git a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html index e190b649f..c0e8ff4b0 100644 --- a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html +++ b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html @@ -1,12 +1,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> -<title>JOGL Graph UI-Scene Demo 01 (NApplet)</title> +<title>JOGL Graph UI-Scene Demo 01 No-AA (NApplet)</title> </head> <body BGCOLOR="#ffffff"> <P> -JOGL Graph UI-Scene Demo 01 +JOGL Graph UI-Scene Demo 01 No-AA </P> <P> @@ -21,7 +21,7 @@ JOGL Graph UI-Scene Demo 01 <param name="gl_profile" value="GL2ES2"> <param name="gl_swap_interval" value="1"> <param name="gl_alpha" value="4"> - <param name="gl_multisamplebuffer" value="4"> + <param name="gl_multisamplebuffer" value="0"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <comment> @@ -37,7 +37,7 @@ JOGL Graph UI-Scene Demo 01 gl_profile="GL2ES2" gl_swap_interval="1" gl_alpha="4" - gl_multisamplebuffer="4" + gl_multisamplebuffer="0" gl_debug="false" gl_trace="false"> <noembed>Sorry, no Java support detected.</noembed> diff --git a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html index 863421d82..b82b82839 100644 --- a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html +++ b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html @@ -1,12 +1,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> -<title>JOGL Graph UI-Scene Demo 01 (NApplet)</title> +<title>JOGL Graph UI-Scene Demo 01 MSAA-4 (NApplet)</title> </head> <body BGCOLOR="#ffffff"> <P> -JOGL Graph UI-Scene Demo 01 +JOGL Graph UI-Scene Demo 01 MSAA-4 </P> <P> @@ -17,11 +17,11 @@ JOGL Graph UI-Scene Demo 01 jar/joal.jar, jar/jogl-all.jar, jar/jogl-test.jar"> - <param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener02> + <param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener0A> <param name="gl_profile" value="GL2ES2"> <param name="gl_swap_interval" value="1"> <param name="gl_alpha" value="4"> - <param name="gl_multisamplebuffer" value="0"> + <param name="gl_multisamplebuffer" value="4"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <comment> @@ -37,7 +37,7 @@ JOGL Graph UI-Scene Demo 01 gl_profile="GL2ES2" gl_swap_interval="1" gl_alpha="4" - gl_multisamplebuffer="0" + gl_multisamplebuffer="4" gl_debug="false" gl_trace="false"> <noembed>Sorry, no Java support detected.</noembed> diff --git a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo03-napplet.html b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo03-napplet.html index 0317d4681..e84e92cf7 100644 --- a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo03-napplet.html +++ b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo03-napplet.html @@ -1,12 +1,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> -<title>JOGL Graph UI-Scene Demo 01 (NApplet)</title> +<title>JOGL Graph UI-Scene Demo 01 VBAA (NApplet)</title> </head> <body BGCOLOR="#ffffff"> <P> -JOGL Graph UI-Scene Demo 01 +JOGL Graph UI-Scene Demo 01 VBAA </P> <P> @@ -21,7 +21,7 @@ JOGL Graph UI-Scene Demo 01 <param name="gl_profile" value="GL2ES2"> <param name="gl_swap_interval" value="1"> <param name="gl_alpha" value="4"> - <param name="gl_multisamplebuffer" value="4"> + <param name="gl_multisamplebuffer" value="0"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <comment> @@ -37,7 +37,7 @@ JOGL Graph UI-Scene Demo 01 gl_profile="GL2ES2" gl_swap_interval="1" gl_alpha="4" - gl_multisamplebuffer="4" + gl_multisamplebuffer="0" gl_debug="false" gl_trace="false"> <noembed>Sorry, no Java support detected.</noembed> diff --git a/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo04-napplet.html b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo04-napplet.html new file mode 100644 index 000000000..db4be720c --- /dev/null +++ b/jnlp-files/jogl-applet-runner-newt-GraphUISceneDemo04-napplet.html @@ -0,0 +1,70 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL Graph UI-Scene Demo 01 Auto-AA (NApplet)</title> +</head> +<body BGCOLOR="#ffffff"> + +<P> +JOGL Graph UI-Scene Demo 01 Auto-AA (VBAA for < 200 dpi) +</P> + +<P> +<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" + width="800" height="400"> + <param name="code" value="com.jogamp.newt.awt.applet.JOGLNewtApplet1Run"> + <param name="archive" value="jar/gluegen-rt.jar, + jar/joal.jar, + jar/jogl-all.jar, + jar/jogl-test.jar"> + <param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener04> + <param name="gl_profile" value="GL2ES2"> + <param name="gl_swap_interval" value="1"> + <param name="gl_alpha" value="4"> + <param name="gl_multisamplebuffer" value="0"> + <param name="gl_debug" value="false"> + <param name="gl_trace" value="false"> + <comment> + <embed code="com.jogamp.newt.awt.applet.JOGLNewtApplet1Run" + width="800" height="400" + type="application/x-java-applet;version=1.6" + pluginspage="http://java.sun.com/javase/downloads/ea.jsp" + archive="jar/gluegen-rt.jar, + jar/joal.jar, + jar/jogl-all.jar, + jar/jogl-test.jar" + gl_event_listener_class="com.jogamp.opengl.test.junit.graph.demos.GPUUISceneGLListener04" + gl_profile="GL2ES2" + gl_swap_interval="1" + gl_alpha="4" + gl_multisamplebuffer="0" + gl_debug="false" + gl_trace="false"> + <noembed>Sorry, no Java support detected.</noembed> + </embed> + </comment> +</object> + +</P> + +<P> +Graph UI-Scene Demo Keys:<br> +<ul> + <li> none - use mouse </li> +</ul> +</P> +<P> +JOGL NEWT JNLP Applet Runner Special Keys:<br> +<ul> + <li> d - toggle decoration </li> + <li> f - toggle fullscreen </li> + <li> r - in/out browser window </li> + <li> a - on/off always-on-top </li> + <li> c - change mouse pointer </li> + <li> i - invisible mouse pointer </li> + <li> w - warp mouse pointer to center </li> +</ul> +</P> + +</body> +</html> diff --git a/jnlp-files/jogl-test-applets.html b/jnlp-files/jogl-test-applets.html index c3d17f0a7..55db0ca57 100644 --- a/jnlp-files/jogl-test-applets.html +++ b/jnlp-files/jogl-test-applets.html @@ -140,8 +140,10 @@ See Legend below table </a> </td> <td> - <a href="jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html">VBAA</a><br/> - <a href="jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html">MSAA</a><br/> + <a href="jogl-applet-runner-newt-GraphUISceneDemo04-napplet.html">Auto</a><br/> + <a href="jogl-applet-runner-newt-GraphUISceneDemo03-napplet.html">VBAA</a><br/> + <a href="jogl-applet-runner-newt-GraphUISceneDemo02-napplet.html">MSAA</a><br/> + <a href="jogl-applet-runner-newt-GraphUISceneDemo01-napplet.html">NONE</a><br/> <!-- a href="jogl-applet-runner-newt-GraphUISceneDemo01.html">Dual</a><br/ --> </td> <td> diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index dbff7032f..1d2234ad9 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -208,7 +208,7 @@ function jrun() { #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" #D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window" #D_ARGS="-Dnewt.debug.Window.KeyEvent" - D_ARGS="-Dnewt.debug.Window.MouseEvent" + #D_ARGS="-Dnewt.debug.Window.MouseEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all" #D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator" @@ -235,6 +235,7 @@ function jrun() { #D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLCode -Djogl.debug.DebugGL -Djogl.debug.TraceGL" #D_ARGS="-Djogl.debug.graph.curve" #D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLCode" + #D_ARGS="-Djogl.debug.DebugGL" #D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.graph.curve.Instance -Djogl.debug.GLSLCode" #D_ARGS="-Djogl.debug.GLSLCode -Djogl.debug.graph.curve.triangulation.LINE_AA -Djogl.debug.graph.curve.Triangulation -Djogl.debug.graph.font.Renderer" #D_ARGS="-Djogl.debug.graph.font.Renderer" @@ -761,7 +762,8 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.graph.demos.ui.UINewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo $* -testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener04.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener04.java new file mode 100644 index 000000000..461e2c114 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener04.java @@ -0,0 +1,7 @@ +package com.jogamp.opengl.test.junit.graph.demos; + +public class GPUUISceneGLListener04 extends GPUUISceneGLListener0A { + public GPUUISceneGLListener04() { + super(GPUUISceneGLListener0A.DefaultNoAADPIThreshold /* noAADPIThreshold */); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index b52668294..6a1f60de7 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.media.opengl.GL; @@ -52,10 +53,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { private boolean debug = false; private boolean trace = false; - private final int renderModes; + private final float noAADPIThreshold; private final RenderState rs; private final SceneUIController sceneUIController; + /** -1 == AUTO, TBD @ init(..) */ + private int renderModes; private RegionRenderer renderer; private final int fontSet = FontFactory.UBUNTU; @@ -78,6 +81,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { private final float fontSizeFpsPVP = 0.038f; private float dpiH = 96; + /** + * Default DPI threshold value to disable {@link Region#VBAA_RENDERING_BIT VBAA}: {@value} dpi + * @see #GPUUISceneGLListener0A(float) + * @see #GPUUISceneGLListener0A(float, boolean, boolean) + */ + public static final float DefaultNoAADPIThreshold = 180f; + private int currentText = 0; private String actionText = null; @@ -102,16 +112,46 @@ public class GPUUISceneGLListener0A implements GLEventListener { this(0); } + /** + * @param noAADPIThreshold see {@link #DefaultNoAADPIThreshold} + */ + public GPUUISceneGLListener0A(final float noAADPIThreshold) { + this(noAADPIThreshold, false, false); + } + + /** + * @param renderModes + */ public GPUUISceneGLListener0A(int renderModes) { - this(RenderState.createRenderState(SVertex.factory()), renderModes, false, false); + this(renderModes, false, false); } - public GPUUISceneGLListener0A(RenderState rs, int renderModes, boolean debug, boolean trace) { - this.rs = rs; - this.renderModes = renderModes; + /** + * @param renderModes + * @param debug + * @param trace + */ + public GPUUISceneGLListener0A(int renderModes, boolean debug, boolean trace) { + this(0f, renderModes, debug, trace); + } + + /** + * @param noAADPIThreshold see {@link #DefaultNoAADPIThreshold} + * @param debug + * @param trace + */ + public GPUUISceneGLListener0A(final float noAADPIThreshold, boolean debug, boolean trace) { + this(noAADPIThreshold, -1, debug, trace); + } + private GPUUISceneGLListener0A(final float noAADPIThreshold, int renderModes, boolean debug, boolean trace) { + this.noAADPIThreshold = noAADPIThreshold; + this.rs = RenderState.createRenderState(SVertex.factory()); this.debug = debug; this.trace = trace; + + this.renderModes = renderModes; + try { font = FontFactory.get(FontFactory.UBUNTU).getDefault(); } catch (IOException ioe) { @@ -593,6 +633,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { } else { System.err.println("Using default DPI of "+dpiH); } + if( 0 > renderModes ) { + final boolean noAA = dpiH >= noAADPIThreshold; + final String noAAs = noAA ? " >= " : " < "; + System.err.println("AUTO RenderMode: dpi "+dpiH+noAAs+noAADPIThreshold+" -> noAA "+noAA); + renderModes = noAA ? 0 : Region.VBAA_RENDERING_BIT; + } if(drawable instanceof GLWindow) { System.err.println("GPUUISceneGLListener0A: init (1)"); final GLWindow glw = (GLWindow) drawable; @@ -715,15 +761,17 @@ public class GPUUISceneGLListener0A implements GLEventListener { if(null == labels[currentText]) { final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight(); final float dyTop = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight(); - final float dxRight = drawable.getSurfaceWidth() * relMiddle; + final float dxMiddle = drawable.getSurfaceWidth() * relMiddle; labels[currentText] = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFixed, strings[currentText]); labels[currentText].setColor(0.1f, 0.1f, 0.1f, 1.0f); labels[currentText].setEnabled(enableOthers); - labels[currentText].translate(dxRight, + labels[currentText].translate(dxMiddle, dyTop - 1.5f * jogampLabel.getLineHeight() - 1.5f * truePtSizeLabel.getLineHeight(), 0f); labels[currentText].addMouseListener(dragZoomRotateListener); sceneUIController.addShape(labels[currentText]); + System.err.println("Label["+currentText+"] CTOR: "+labels[currentText]); + System.err.println("Label["+currentText+"] CTOR: "+Arrays.toString(labels[currentText].getTranslate())); } if( fpsLabel.isEnabled() ) { final float lfps, tfps, td; @@ -741,8 +789,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { final String text; if( null == actionText ) { final String timePrec = gl.isGLES() ? "4.0" : "4.1"; - text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize %.1f, %s-samples %d, q %d, td %"+timePrec+"f, blend %b, alpha-bits %d, msaa-bits %d", - lfps, tfps, gl.getSwapInterval(), fontSizeFixedPVP, modeS, sceneUIController.getSampleCount(), fpsLabel.getQuality(), td, + text = String.format("%03.1f/%03.1f fps, v-sync %d, dpi %.1f, fontSize %.1f, %s-samples %d, q %d, td %"+timePrec+"f, blend %b, alpha %d, msaa %d", + lfps, tfps, gl.getSwapInterval(), dpiH, fontSizeFixedPVP, modeS, sceneUIController.getSampleCount(), fpsLabel.getQuality(), td, renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED), drawable.getChosenGLCapabilities().getAlphaBits(), drawable.getChosenGLCapabilities().getNumSamples()); @@ -780,12 +828,18 @@ public class GPUUISceneGLListener0A implements GLEventListener { for(int i=buttonsLeftCount; i<buttons.size(); i++) { buttons.get(i).translate(dxRight, dyTop, dz); } - final float dyTopLabel = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight(); - jogampLabel.translate(dxMiddle, dyTopLabel, dz); - truePtSizeLabel.translate(dxMiddle, dyTopLabel, dz); + final float dxMiddleAbs = width * relMiddle; + final float dyTopLabelAbs = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight(); + jogampLabel.setTranslate(dxMiddleAbs, dyTopLabelAbs, dz); + truePtSizeLabel.setTranslate(dxMiddleAbs, dyTopLabelAbs, dz); + truePtSizeLabel.setTranslate(dxMiddleAbs, dyTopLabelAbs - 1.5f * jogampLabel.getLineHeight(), 0f); fpsLabel.translate(0f, 0f, 0f); if( null != labels[currentText] ) { - labels[currentText].translate(dxMiddle, dyTopLabel, 0f); + labels[currentText].setTranslate(dxMiddleAbs, + dyTopLabelAbs - 1.5f * jogampLabel.getLineHeight() + - 1.5f * truePtSizeLabel.getLineHeight(), 0f); + System.err.println("Label["+currentText+"] MOVE: "+labels[currentText]); + System.err.println("Label["+currentText+"] MOVE: "+Arrays.toString(labels[currentText].getTranslate())); } crossHairCtr.translate(dw/2f, dh/2f, 0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java new file mode 100644 index 000000000..a80b70830 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java @@ -0,0 +1,147 @@ +package com.jogamp.opengl.test.junit.graph.demos; + +import java.awt.Component; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +import javax.media.nativewindow.util.Dimension; +import javax.media.nativewindow.util.DimensionImmutable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; +import javax.swing.SwingUtilities; + +import org.junit.Assume; + +import com.jogamp.graph.curve.Region; +import com.jogamp.newt.awt.NewtCanvasAWT; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.util.Animator; + +public class GPUUISceneNewtCanvasAWTDemo { + static final boolean DEBUG = false; + static final boolean TRACE = false; + + static int SceneMSAASamples = 0; + static boolean GraphVBAAMode = false; + static boolean GraphMSAAMode = false; + static float GraphAutoMode = GPUUISceneGLListener0A.DefaultNoAADPIThreshold; + + static void setComponentSize(final Component comp, final DimensionImmutable new_sz) { + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight()); + comp.setMinimumSize(d); + comp.setPreferredSize(d); + comp.setSize(d); + } } ); + } catch( Throwable throwable ) { + throwable.printStackTrace(); + Assume.assumeNoException( throwable ); + } + } + + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + int width = 800, height = 400; + int x = 10, y = 10; + if( 0 != args.length ) { + for(int i=0; i<args.length; i++) { + if(args[i].equals("-smsaa")) { + i++; + SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); + GraphMSAAMode = false; + GraphVBAAMode = false; + GraphAutoMode = 0f; + } else if(args[i].equals("-gmsaa")) { + GraphMSAAMode = true; + GraphVBAAMode = false; + GraphAutoMode = 0f; + } else if(args[i].equals("-gvbaa")) { + GraphMSAAMode = false; + GraphVBAAMode = true; + GraphAutoMode = 0f; + } else if(args[i].equals("-gauto")) { + GraphMSAAMode = false; + GraphVBAAMode = true; + i++; + GraphAutoMode = MiscUtils.atof(args[i], GraphAutoMode); + } else if(args[i].equals("-width")) { + i++; + width = MiscUtils.atoi(args[i], width); + } else if(args[i].equals("-height")) { + i++; + height = MiscUtils.atoi(args[i], height); + } else if(args[i].equals("-x")) { + i++; + x = MiscUtils.atoi(args[i], x); + } else if(args[i].equals("-y")) { + i++; + y = MiscUtils.atoi(args[i], y); + } + } + } + System.err.println("Desired win size "+width+"x"+height); + System.err.println("Desired win pos "+x+"/"+y); + System.err.println("Scene MSAA Samples "+SceneMSAASamples); + System.err.println("Graph MSAA Mode "+GraphMSAAMode); + System.err.println("Graph VBAA Mode "+GraphVBAAMode); + System.err.println("Graph Auto Mode "+GraphAutoMode+" no-AA dpi threshold"); + + GLProfile glp = GLProfile.getGL2ES2(); + GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + if( SceneMSAASamples > 0 ) { + caps.setSampleBuffers(true); + caps.setNumSamples(SceneMSAASamples); + } + System.out.println("Requested: " + caps); + + final int rmode; + if( 0 < GraphAutoMode ) { + rmode = -1; + } else if( GraphVBAAMode ) { + rmode = Region.VBAA_RENDERING_BIT; + } else if( GraphMSAAMode ) { + rmode = Region.MSAA_RENDERING_BIT; + } else { + rmode = 0; + } + + final GLWindow window = GLWindow.create(caps); + window.setPosition(x, y); + window.setSize(width, height); + window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); + + GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : + new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); + + window.addGLEventListener(sceneGLListener); + sceneGLListener.attachInputListenerTo(window); + + final Animator animator = new Animator(); + animator.setUpdateFPSFrames(60, System.err); + animator.add(window); + + window.addWindowListener(new WindowAdapter() { + public void windowDestroyed(WindowEvent e) { + animator.stop(); + } + }); + + final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(window); + final Frame frame = new Frame("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); + + setComponentSize(newtCanvasAWT, new Dimension(width, height)); + frame.add(newtCanvasAWT); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.pack(); + frame.setVisible(true); + } + }); + animator.start(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java index 9e5ecb648..dbf0838eb 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java @@ -4,8 +4,6 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; @@ -17,8 +15,9 @@ public class GPUUISceneNewtDemo { static final boolean TRACE = false; static int SceneMSAASamples = 0; - static boolean GraphVBAAMode = true; + static boolean GraphVBAAMode = false; static boolean GraphMSAAMode = false; + static float GraphAutoMode = GPUUISceneGLListener0A.DefaultNoAADPIThreshold; public static void main(String[] args) { int width = 800, height = 400; @@ -30,12 +29,20 @@ public class GPUUISceneNewtDemo { SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); GraphMSAAMode = false; GraphVBAAMode = false; + GraphAutoMode = 0f; } else if(args[i].equals("-gmsaa")) { GraphMSAAMode = true; GraphVBAAMode = false; + GraphAutoMode = 0f; } else if(args[i].equals("-gvbaa")) { GraphMSAAMode = false; GraphVBAAMode = true; + GraphAutoMode = 0f; + } else if(args[i].equals("-gauto")) { + GraphMSAAMode = false; + GraphVBAAMode = true; + i++; + GraphAutoMode = MiscUtils.atof(args[i], GraphAutoMode); } else if(args[i].equals("-width")) { i++; width = MiscUtils.atoi(args[i], width); @@ -56,6 +63,7 @@ public class GPUUISceneNewtDemo { System.err.println("Scene MSAA Samples "+SceneMSAASamples); System.err.println("Graph MSAA Mode "+GraphMSAAMode); System.err.println("Graph VBAA Mode "+GraphVBAAMode); + System.err.println("Graph Auto Mode "+GraphAutoMode+" no-AA dpi threshold"); GLProfile glp = GLProfile.getGL2ES2(); GLCapabilities caps = new GLCapabilities(glp); @@ -67,7 +75,9 @@ public class GPUUISceneNewtDemo { System.out.println("Requested: " + caps); final int rmode; - if( GraphVBAAMode ) { + if( 0 < GraphAutoMode ) { + rmode = -1; + } else if( GraphVBAAMode ) { rmode = Region.VBAA_RENDERING_BIT; } else if( GraphMSAAMode ) { rmode = Region.MSAA_RENDERING_BIT; @@ -80,8 +90,8 @@ public class GPUUISceneNewtDemo { window.setSize(width, height); window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); - final RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPUUISceneGLListener0A sceneGLListener = new GPUUISceneGLListener0A(rs, rmode, DEBUG, TRACE); + GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : + new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); window.addGLEventListener(sceneGLListener); sceneGLListener.attachInputListenerTo(window); |