summaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-18 17:06:16 +0100
committerSven Gothel <[email protected]>2010-11-18 17:06:16 +0100
commit96af6c9bf2d683115996214cd895f9f9ef7ceea6 (patch)
treedf27c2645d4f4db83c3def16712a5355a6cc2c2d /src/junit
parent5356769e7f6ebb0ab1322ab26b2dfb9284054e0d (diff)
JOGL/AWT: Fix ~ 2 year old regressions: Choose & Use GraphicsConfiguration for Canvas. ; Adding FSAA test.
Canvas/X11: The Canvas GraphicsConfiguraton should be chosen before the native peer is being created. Choosing AWT GraphicsConfiguration (all platforms): Don't filter our capabilities with 'AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsChosen, gc)', not necessary (see above) and it would remove ourrequired alpha channel. Canvas display(): Don't render if drawable is not realized (yet).
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java2
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/caps/MultisampleChooser01.java66
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/caps/MultisampleDemo01.java138
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleAWT.java122
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleNEWT.java100
-rw-r--r--src/junit/com/jogamp/test/junit/util/MiscUtils.java3
7 files changed, 431 insertions, 5 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
index f3c228a5d..09dfc856d 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -89,8 +89,6 @@ public class TestAWT01GLn extends UITestCase {
glCanvas.addGLEventListener(new Gears());
- glCanvas.display(); // one in process display
-
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -100,6 +98,9 @@ public class TestAWT01GLn extends UITestCase {
t.printStackTrace();
Assume.assumeNoException(t);
}
+
+ glCanvas.display(); // one in process display
+
Animator animator = new Animator(glCanvas);
animator.start();
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
index 03d4f37bf..a32dc90dc 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
@@ -86,8 +86,8 @@ public class TestSwingAWT01GLn extends UITestCase {
glCanvas[0].addGLEventListener(new Gears());
window.add(glCanvas[0]);
window.setSize(512, 512);
- glCanvas[0].display();
window.setVisible(true);
+ glCanvas[0].display();
}
};
diff --git a/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleChooser01.java b/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleChooser01.java
new file mode 100644
index 000000000..7dcde18c9
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleChooser01.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 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:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+package com.jogamp.test.junit.jogl.caps;
+
+import javax.media.opengl.DefaultGLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+
+class MultisampleChooser01 extends DefaultGLCapabilitiesChooser {
+
+ public int chooseCapabilities(GLCapabilitiesImmutable desired, GLCapabilitiesImmutable[] available, int windowSystemRecommendedChoice) {
+ boolean anyHaveSampleBuffers = false;
+ for (int i = 0; i < available.length; i++) {
+ GLCapabilitiesImmutable caps = available[i];
+ if (caps != null && caps.getSampleBuffers()) {
+ anyHaveSampleBuffers = true;
+ break;
+ }
+ }
+ int selection = super.chooseCapabilities(desired, available, windowSystemRecommendedChoice);
+ if (!anyHaveSampleBuffers) {
+ System.err.println("WARNING: antialiasing will be disabled because none of the available pixel formats had it to offer");
+ } else {
+ if (!available[selection].getSampleBuffers()) {
+ System.err.println("WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it");
+ }
+ }
+ return selection;
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleDemo01.java b/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleDemo01.java
new file mode 100644
index 000000000..e399de0bc
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/caps/MultisampleDemo01.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 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:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.test.junit.jogl.caps;
+
+import com.jogamp.opengl.impl.x11.glx.GLX;
+import com.jogamp.opengl.impl.x11.glx.X11GLXGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLPipelineFactory;
+
+class MultisampleDemo01 implements GLEventListener {
+
+ static boolean glDebug = false;
+ static boolean glTrace = false;
+
+ boolean multisample;
+
+ public MultisampleDemo01(boolean multisample) {
+ this.multisample = multisample;
+ }
+
+ public void init(GLAutoDrawable drawable) {
+ AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ System.err.println();
+ System.err.println("Info: " + config);
+ System.err.println();
+ if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) {
+ X11GLXGraphicsConfiguration x11config = (X11GLXGraphicsConfiguration) config;
+ long display = drawable.getNativeSurface().getDisplayHandle();
+ int[] foo = new int[1];
+ GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLES, foo, 0);
+ System.out.println("GLX_SAMPLES " + foo[0]);
+ GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLE_BUFFERS, foo, 0);
+ System.out.println("GLX_SAMPLE_BUFFERS " + foo[0]);
+ }
+ GL _gl = drawable.getGL();
+ if (glDebug) {
+ try {
+ // Debug ..
+ _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Debug", GL2.class, _gl, null));
+ if (glTrace) {
+ // Trace ..
+ _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Trace", GL2.class, _gl, new Object[]{System.err}));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ GL2 gl = _gl.getGL2();
+ if (multisample) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+ gl.glClearColor(0, 0, 0, 0);
+ // gl.glEnable(GL.GL_DEPTH_TEST);
+ // gl.glDepthFunc(GL.GL_LESS);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glOrtho(-1, 1, -1, 1, -1, 1);
+ if (multisample) {
+ gl.glDisable(GL.GL_MULTISAMPLE);
+ }
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+ if (multisample) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ int numSteps = 20;
+ double increment = Math.PI / numSteps;
+ double radius = 1;
+ gl.glBegin(GL.GL_LINES);
+ for (int i = numSteps - 1; i >= 0; i--) {
+ gl.glVertex3d(radius * Math.cos(i * increment), radius * Math.sin(i * increment), 0);
+ gl.glVertex3d(-1.0 * radius * Math.cos(i * increment), -1.0 * radius * Math.sin(i * increment), 0);
+ }
+ gl.glEnd();
+ if (multisample) {
+ gl.glDisable(GL.GL_MULTISAMPLE);
+ }
+ }
+
+ // Unused routines
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleAWT.java b/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleAWT.java
new file mode 100755
index 000000000..c6e7f08fa
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleAWT.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 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:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.test.junit.jogl.caps;
+
+import com.jogamp.test.junit.util.MiscUtils;
+import java.awt.*;
+import javax.media.opengl.*;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.test.junit.util.UITestCase;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.awt.AWTGraphicsConfiguration;
+import javax.media.nativewindow.awt.AWTGraphicsDevice;
+import javax.media.nativewindow.awt.AWTGraphicsScreen;
+import org.junit.Test;
+
+
+public class TestMultisampleAWT extends UITestCase {
+ static long durationPerTest = 500; // ms
+ private GLCanvas canvas;
+
+ public static void main(String[] args) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], 500);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
+ String tstname = TestMultisampleAWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+ @Test
+ public void testMultiSampleAA4() throws InterruptedException {
+ testMultiSampleAAImpl(4);
+ }
+
+ // @Test
+ public void testMultiSampleNone() throws InterruptedException {
+ testMultiSampleAAImpl(0);
+ }
+
+ private void testMultiSampleAAImpl(int samples) throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(null);
+ GLCapabilitiesChooser chooser = new MultisampleChooser01();
+
+ if(samples>0) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(samples);
+ }
+ // turns out we need to have alpha,
+ // otherwise no AA will be visible.
+ caps.setAlphaBits(1);
+
+ /**
+ * whatever I tried here (passing and preconfig GraphicsConfiguration)
+ * either it just didn't picked up .. or the context couldn't be made current.
+ *
+ GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ GraphicsConfiguration gc = AWTGraphicsConfiguration.getAWTGraphicsConfiguration(caps, gd);
+
+ AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(gd, AbstractGraphicsDevice.DEFAULT_UNIT);
+ AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
+ GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(caps, caps,
+ chooser, aScreen);
+ canvas = new GLCanvas(caps, chooser, null, gd, config.getGraphicsConfiguration(), config); */
+ canvas = new GLCanvas(caps, chooser, null, null);
+ canvas.addGLEventListener(new MultisampleDemo01(samples>0?true:false));
+
+ Frame frame = new Frame("Multi Samples "+samples);
+ frame.setLayout(new BorderLayout());
+ canvas.setSize(512, 512);
+ frame.add(canvas, BorderLayout.CENTER);
+ frame.pack();
+ frame.setVisible(true);
+ frame.setLocation(0, 0);
+ canvas.requestFocus();
+
+ Thread.sleep(durationPerTest);
+
+ frame.dispose();
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleNEWT.java b/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleNEWT.java
new file mode 100755
index 000000000..c060828ec
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/caps/TestMultisampleNEWT.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 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:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.jogamp.test.junit.jogl.caps;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.test.junit.util.MiscUtils;
+import javax.media.opengl.*;
+import org.junit.Test;
+
+public class TestMultisampleNEWT {
+ static long durationPerTest = 500; // ms
+ private GLWindow window;
+
+ public static void main(String[] args) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], 500);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
+ String tstname = TestMultisampleNEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+ @Test
+ public void testMultiSampleAA4() throws InterruptedException {
+ testMultiSampleAAImpl(4);
+ }
+
+ // @Test
+ public void testMultiSampleNone() throws InterruptedException {
+ testMultiSampleAAImpl(0);
+ }
+
+ private void testMultiSampleAAImpl(int samples) throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(null);
+ GLCapabilitiesChooser chooser = new MultisampleChooser01();
+
+ if(samples>0) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(4);
+ }
+ // turns out we need to have alpha,
+ // otherwise no AA will be visible.
+ caps.setAlphaBits(1);
+
+ window = GLWindow.create(caps);
+ window.setCapabilitiesChooser(chooser);
+ window.addGLEventListener(new MultisampleDemo01(samples>0?true:false));
+ window.setSize(512, 512);
+ window.setVisible(true);
+ window.setPosition(0, 0);
+ window.requestFocus();
+
+ GLCapabilitiesImmutable capsChosen0 = window.getChosenGLCapabilities();
+
+ Thread.sleep(durationPerTest);
+
+ window.destroy();
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/util/MiscUtils.java b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
index 672bb7de0..bb2abcd87 100644
--- a/src/junit/com/jogamp/test/junit/util/MiscUtils.java
+++ b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
@@ -32,8 +32,7 @@ package com.jogamp.test.junit.util;
import java.lang.reflect.*;
public class MiscUtils {
- @Deprecated
- public static int str2int(String str, int def) {
+ public static int atoi(String str, int def) {
try {
return Integer.parseInt(str);
} catch (Exception ex) {