aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-17 14:53:44 +0200
committerSven Gothel <[email protected]>2013-04-17 14:53:44 +0200
commit1af639340bb119e4839170c6e5e3258012d99136 (patch)
tree4e66529b4937662f65627a249bb303ca91151b09
parent94d3960757db292eeefb7acdfa1220b6b7168b98 (diff)
Bug 718: Windows BITMAP Offscreen Fails w/ GLCaps other than simple RGB888 - Refine Unit Tests ; UITestCase.Snapshot: Add RGBA bits to filename.
Split TestGLAutoDrawableFactoryOffscrnCapsNEWT to TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT and TestGLAutoDrawableFactoryES2OffscrnCapsNEWT TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT contains more 'Bitmap' tests of various caps, w/ snapshots.
-rwxr-xr-xmake/scripts/java-win64-dbg.bat2
-rwxr-xr-xmake/scripts/tests-x64.bat5
-rwxr-xr-xmake/scripts/tests.sh6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java)149
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java381
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java116
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/UITestCase.java8
10 files changed, 586 insertions, 109 deletions
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index c14385fc7..8669ba8f8 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -31,7 +31,7 @@ REM set D_ARGS="-Djogl.debug.ExtensionAvailabilityCache" "-Djogl.debug=all" "-Dn
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.ExtensionAvailabilityCache" "-Djogamp.debug.ProcAddressHelper=true"
REM set D_ARGS="-Dnativewindow.debug.GraphicsConfiguration"
-REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.GLDrawable" "-Dnativewindow.debug.GraphicsConfiguration"
+REM set D_ARGS="-Djogl.debug.GLDrawable" "-Dnativewindow.debug.GraphicsConfiguration" "-Djogl.debug.CapabilitiesChooser"
REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLProfile=true"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index d647c2d4a..3990fb7b2 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -21,7 +21,7 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGPUMe
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext02NEWT %*
-scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAO %*
+REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAO %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT %*
@@ -32,7 +32,8 @@ REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclu
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $*
-REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $*
+scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT $*
+REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryES2OffscrnCapsNEWT $*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableOffThreadSharedContextES2NEWT $*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index fa965d83b..18ff8e756 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -202,6 +202,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel"
#D_ARGS="-Djogl.debug.PNGImage"
#D_ARGS="-Djogl.debug.JPEGImage"
+ #D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser"
#X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false"
#X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false"
#X_ARGS="-verbose:jni"
@@ -306,7 +307,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $*
@@ -338,7 +339,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryES2OffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java
index f8092d064..adef9ed15 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java
@@ -46,7 +46,6 @@ import org.junit.Test;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -57,7 +56,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
* </p>
*/
-public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
+public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
volatile int szStep = 2;
@@ -90,9 +89,9 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
Assert.assertNotNull(chosenCaps);
- Assert.assertTrue(chosenCaps.getGreenBits()>5);
- Assert.assertTrue(chosenCaps.getBlueBits()>5);
- Assert.assertTrue(chosenCaps.getRedBits()>5);
+ Assert.assertTrue(chosenCaps.getGreenBits()>4);
+ Assert.assertTrue(chosenCaps.getBlueBits()>4);
+ Assert.assertTrue(chosenCaps.getRedBits()>4);
glad.display(); // force native context creation
@@ -103,9 +102,9 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
System.out.println("Chosen GL Caps(2): "+glad.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities());
Assert.assertNotNull(chosenGLCaps);
- Assert.assertTrue(chosenGLCaps.getGreenBits()>5);
- Assert.assertTrue(chosenGLCaps.getBlueBits()>5);
- Assert.assertTrue(chosenGLCaps.getRedBits()>5);
+ Assert.assertTrue(chosenGLCaps.getGreenBits()>4);
+ Assert.assertTrue(chosenGLCaps.getBlueBits()>4);
+ Assert.assertTrue(chosenGLCaps.getRedBits()>4);
Assert.assertTrue(chosenGLCaps.getDepthBits()>4);
Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps.isOnscreen());
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
@@ -165,16 +164,16 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenAutoDblBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenAutoDblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
doTest(reqGLCaps, new GearsES2(1));
}
@Test
- public void testGL2OffScreenFBODblBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenFBODblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setFBO(true);
@@ -182,8 +181,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenFBOSglBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenFBOSglBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setFBO(true);
@@ -192,8 +191,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenFBODblBufStencil() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenFBODblBufStencil() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setFBO(true);
@@ -202,8 +201,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenFBODblBufMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setFBO(true);
@@ -213,8 +212,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setFBO(true);
@@ -225,8 +224,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenPbufferDblBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenPbufferDblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
@@ -234,8 +233,8 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
}
@Test
- public void testGL2OffScreenPbufferSglBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ public void testES2OffScreenPbufferSglBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
@@ -243,109 +242,101 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase {
doTest(reqGLCaps, new GearsES2(1));
}
+ // Might be reduced to !stencil
@Test
- public void testGL2OffScreenBitmapSglBuf() throws InterruptedException {
- final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
- if(null == reqGLCaps) return;
- reqGLCaps.setOnscreen(false);
- reqGLCaps.setBitmap(true);
- reqGLCaps.setDoubleBuffered(false);
- doTest(reqGLCaps, new Gears(1));
- }
-
- @Test
- public void testES2OffScreenAutoDblBuf() throws InterruptedException {
+ public void testES2OffScreenPbufferDblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
+ // Might be reduced to !MSAA
@Test
- public void testES2OffScreenFBOSglBuf() throws InterruptedException {
+ public void testES2OffScreenPbufferDblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setFBO(true);
- reqGLCaps.setDoubleBuffered(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
+ // Might be reduced to !stencil && !MSAA
@Test
- public void testES2OffScreenFBODblBuf() throws InterruptedException {
+ public void testES2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setFBO(true);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setStencilBits(1);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
+ /** NOT Implemented:
+ // Might be reduced to !double-buff
@Test
- public void testES2OffScreenFBODblBufStencil() throws InterruptedException {
+ public void testES2OffScreenBitmapDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setFBO(true);
- reqGLCaps.setStencilBits(1);
- doTest(reqGLCaps, new GearsES2(1));
+ reqGLCaps.setBitmap(true);
+ doTest(reqGLCaps, new Gears(1));
}
@Test
- public void testES2OffScreenFBODblBufMSAA() throws InterruptedException {
+ public void testES2OffScreenBitmapSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setFBO(true);
- reqGLCaps.setSampleBuffers(true);
- reqGLCaps.setNumSamples(4);
- doTest(reqGLCaps, new GearsES2(1));
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setDoubleBuffered(false);
+ doTest(reqGLCaps, new Gears(1));
}
+ // Might be reduced to !stencil
@Test
- public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
+ public void testES2OffScreenBitmapDblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setFBO(true);
+ reqGLCaps.setBitmap(true);
reqGLCaps.setStencilBits(1);
- reqGLCaps.setSampleBuffers(true);
- reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
}
+ // Might be reduced to !MSAA
@Test
- public void testES2OffScreenPbufferDblBuf() throws InterruptedException {
+ public void testES2OffScreenBitmapDblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setPBuffer(true);
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
+ // Might be reduced to !stencil && !MSAA
@Test
- public void testES2OffScreenPbufferSglBuf() throws InterruptedException {
+ public void testES2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
if(null == reqGLCaps) return;
reqGLCaps.setOnscreen(false);
- reqGLCaps.setPBuffer(true);
- reqGLCaps.setDoubleBuffered(false);
- doTest(reqGLCaps, new GearsES2(1));
- }
-
- /** Not implemented !
- @Test
- public void testES2OffScreenBitmapDblBuf() throws InterruptedException {
- if(!checkProfile(GLProfile.GLES2)) {
- return;
- }
- final GLCapabilities reqGLCaps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
- reqGLCaps.setOnscreen(false);
reqGLCaps.setBitmap(true);
+ reqGLCaps.setStencilBits(1);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- } */
-
+ } */
+
public static void main(String args[]) throws IOException {
- org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryOffscrnCapsNEWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
new file mode 100644
index 000000000..80e56f862
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
@@ -0,0 +1,381 @@
+/**
+ * Copyright 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.io.IOException;
+
+import javax.media.nativewindow.CapabilitiesImmutable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLOffscreenAutoDrawable;
+import javax.media.opengl.GLProfile;
+
+import jogamp.opengl.GLGraphicsConfigurationUtil;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
+ * <p>
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ * </p>
+ */
+public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
+ static final int widthStep = 800/4;
+ static final int heightStep = 600/4;
+ volatile int szStep = 2;
+
+ static GLCapabilities getCaps(String profile) {
+ if( !GLProfile.isAvailable(profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ }
+ return new GLCapabilities(GLProfile.get(profile));
+ }
+
+ void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
+ System.out.println("Requested GL Caps: "+reqGLCaps);
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
+ final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null);
+ System.out.println("Expected GL Caps: "+expGLCaps);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
+
+ Assert.assertNotNull(glad);
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ Assert.assertTrue(glad.isRealized());
+
+ // Check caps of NativeWindow config w/o GL
+ final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
+ System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
+ Assert.assertNotNull(chosenCaps);
+ Assert.assertTrue(chosenCaps.getGreenBits()>4);
+ Assert.assertTrue(chosenCaps.getBlueBits()>4);
+ Assert.assertTrue(chosenCaps.getRedBits()>4);
+
+ glad.display(); // force native context creation
+
+ // Check caps of GLDrawable after realization
+ final GLCapabilitiesImmutable chosenGLCaps = glad.getChosenGLCapabilities();
+ System.out.println("Chosen GL CTX (1): "+glad.getContext().getGLVersion());
+ System.out.println("Chosen GL Caps(1): "+chosenGLCaps);
+ System.out.println("Chosen GL Caps(2): "+glad.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities());
+
+ Assert.assertNotNull(chosenGLCaps);
+ Assert.assertTrue(chosenGLCaps.getGreenBits()>4);
+ Assert.assertTrue(chosenGLCaps.getBlueBits()>4);
+ Assert.assertTrue(chosenGLCaps.getRedBits()>4);
+ Assert.assertTrue(chosenGLCaps.getDepthBits()>4);
+ Assert.assertEquals(expGLCaps.isOnscreen(), chosenGLCaps.isOnscreen());
+ Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
+ Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
+ Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
+ /** Single/Double buffer cannot be checked since result may vary ..
+ if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
+ // dbl buffer may be disabled w/ offscreen pbuffer and bitmap
+ Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
+ } */
+
+ glad.addGLEventListener(demo);
+
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ glad.addGLEventListener(snapshotGLEventListener);
+
+ glad.display(); // initial resize/display
+
+ // 1 - szStep = 2
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
+ snapshotGLEventListener.setMakeSnapshot();
+ glad.display();
+
+ // 2, 3 (resize + display)
+ szStep = 1;
+ glad.setSize(widthStep*szStep, heightStep*szStep);
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
+ snapshotGLEventListener.setMakeSnapshot();
+ glad.display();
+
+ // 4, 5 (resize + display)
+ szStep = 4;
+ glad.setSize(widthStep*szStep, heightStep*szStep);
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
+ snapshotGLEventListener.setMakeSnapshot();
+ glad.display();
+
+ Thread.sleep(50);
+
+ glad.destroy();
+ System.out.println("Fin Drawable: "+glad);
+ }
+
+ @Test
+ public void testAvailableInfo() {
+ GLDrawableFactory f = GLDrawableFactory.getDesktopFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ f = GLDrawableFactory.getEGLFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ }
+
+ @Test
+ public void testGL2OffScreenAutoDblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenFBODblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setFBO(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenFBOSglBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setFBO(true);
+ reqGLCaps.setDoubleBuffered(false);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenFBODblBufStencil() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setFBO(true);
+ reqGLCaps.setStencilBits(1);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setFBO(true);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setFBO(true);
+ reqGLCaps.setStencilBits(1);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenPbufferDblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenPbufferSglBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setDoubleBuffered(false);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !stencil
+ @Test
+ public void testGL2OffScreenPbufferDblBufStencil() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setStencilBits(1);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !MSAA
+ @Test
+ public void testGL2OffScreenPbufferDblBufMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !stencil && !MSAA
+ @Test
+ public void testGL2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setPBuffer(true);
+ reqGLCaps.setStencilBits(1);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+
+ // Might be reduced to !double-buff
+ @Test
+ public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenBitmapDblBufRGBA8881() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setRedBits(8);
+ reqGLCaps.setGreenBits(8);
+ reqGLCaps.setBlueBits(8);
+ reqGLCaps.setAlphaBits(1);
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenBitmapDblBufRGB555() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setRedBits(5);
+ reqGLCaps.setGreenBits(5);
+ reqGLCaps.setBlueBits(5);
+ reqGLCaps.setAlphaBits(0);
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenBitmapDblBufRGBA5551() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setRedBits(5);
+ reqGLCaps.setGreenBits(5);
+ reqGLCaps.setBlueBits(5);
+ reqGLCaps.setAlphaBits(1);
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ @Test
+ public void testGL2OffScreenBitmapSglBuf() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setDoubleBuffered(false);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !stencil
+ @Test
+ public void testGL2OffScreenBitmapDblBufStencil() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setStencilBits(1);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !MSAA
+ @Test
+ public void testGL2OffScreenBitmapDblBufMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ // Might be reduced to !stencil && !MSAA
+ @Test
+ public void testGL2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
+ if(null == reqGLCaps) return;
+ reqGLCaps.setOnscreen(false);
+ reqGLCaps.setBitmap(true);
+ reqGLCaps.setStencilBits(1);
+ reqGLCaps.setSampleBuffers(true);
+ reqGLCaps.setNumSamples(4);
+ doTest(reqGLCaps, new Gears(1));
+ }
+
+ public static void main(String args[]) throws IOException {
+ org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.class.getName());
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
index 78ee2f6b5..3d8fa69ea 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
@@ -199,6 +199,8 @@ public class TestGearsES2AWT extends UITestCase {
frame.setTitle("Gears AWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval);
glCanvas.addGLEventListener(new GearsES2(swapInterval));
+ final SnapshotGLEventListener snap = new SnapshotGLEventListener();
+ glCanvas.addGLEventListener(snap);
final Animator animator = useAnimator ? new Animator(glCanvas) : null;
if( useAnimator && exclusiveContext ) {
@@ -230,6 +232,8 @@ public class TestGearsES2AWT extends UITestCase {
}
System.err.println("canvas pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getWidth()+"x"+glCanvas.getHeight());
+
+ snap.setMakeSnapshot();
if( null != rwsize ) {
Thread.sleep(500); // 500ms delay
@@ -237,6 +241,8 @@ public class TestGearsES2AWT extends UITestCase {
System.err.println("window resize pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getWidth()+"x"+glCanvas.getHeight());
}
+ snap.setMakeSnapshot();
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -309,9 +315,7 @@ public class TestGearsES2AWT extends UITestCase {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
- try {
- duration = Integer.parseInt(args[i]);
- } catch (Exception ex) { ex.printStackTrace(); }
+ duration = MiscUtils.atol(args[i], duration);
} else if(args[i].equals("-rwidth")) {
i++;
rw = MiscUtils.atoi(args[i], rw);
@@ -367,6 +371,7 @@ public class TestGearsES2AWT extends UITestCase {
System.err.println("forceGL3 "+forceGL3);
System.err.println("swapInterval "+swapInterval);
System.err.println("exclusiveContext "+exclusiveContext);
+ System.err.println("useMSAA "+useMSAA);
System.err.println("useAnimator "+useAnimator);
System.err.println("shallUseOffscreenFBOLayer "+shallUseOffscreenFBOLayer);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index 5dee22e1d..50f759079 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -122,6 +122,8 @@ public class TestGearsES2NEWT extends UITestCase {
final GearsES2 demo = new GearsES2(swapInterval);
demo.setPMVUseBackingArray(pmvUseBackingArray);
glWindow.addGLEventListener(demo);
+ final SnapshotGLEventListener snap = new SnapshotGLEventListener();
+ glWindow.addGLEventListener(snap);
if(waitForKey) {
glWindow.addGLEventListener(new GLEventListener() {
public void init(GLAutoDrawable drawable) { }
@@ -266,12 +268,16 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
+ snap.setMakeSnapshot();
+
if( null != rwsize ) {
Thread.sleep(500); // 500ms delay
glWindow.setSize(rwsize.getWidth(), rwsize.getHeight());
System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
}
+ snap.setMakeSnapshot();
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1-t0<duration) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
index 9c1293e22..6fb0a9ff6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
@@ -67,23 +67,20 @@ public class Gears implements GLEventListener {
public int getGear3() { return gear3; }
public void init(GLAutoDrawable drawable) {
- System.err.println("Gears: Init: "+drawable);
- // Use debug pipeline
- // drawable.setGL(new DebugGL(drawable.getGL()));
-
GL2 gl = drawable.getGL().getGL2();
- System.err.println("Gears (GL2) init on "+Thread.currentThread());
+ System.err.println("GearsGL2 init on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
System.err.println("INIT GL IS: " + gl.getClass().getName());
System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
- System.err.println("GL GLSL: "+gl.hasGLSL()+", has-compiler: "+gl.isFunctionAvailable("glCompileShader")+", version "+(gl.hasGLSL() ? gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION) : "none"));
+ System.err.println("GL GLSL: "+gl.hasGLSL()+", has-compiler: "+gl.isFunctionAvailable("glCompileShader")+", version "+(gl.hasGLSL() ? gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION) : "none")+", "+gl.getContext().getGLSLVersionNumber());
System.err.println("GL FBO: basic "+ gl.hasBasicFBOSupport()+", full "+gl.hasFullFBOSupport());
System.err.println("GL Profile: "+gl.getGLProfile());
+ System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString());
System.err.println("GL:" + gl + ", " + gl.getContext().getGLVersion());
-
+
float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
float red[] = { 0.8f, 0.1f, 0.0f, 0.7f };
float green[] = { 0.0f, 0.8f, 0.2f, 0.7f };
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
index d27f3dcf8..6221a1029 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
@@ -30,11 +30,18 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt;
import javax.media.opengl.*;
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
import com.jogamp.opengl.util.FPSAnimator;
import javax.media.opengl.awt.GLJPanel;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
+
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Dimension;
@@ -50,6 +57,12 @@ import org.junit.Test;
public class TestGearsGLJPanelAWT extends UITestCase {
static GLProfile glp;
static int width, height;
+ static boolean shallUsePBuffer = false;
+ static boolean shallUseBitmap = false;
+ static boolean useMSAA = false;
+ static int swapInterval = 1;
+ static boolean useAnimator = true;
+ static boolean manualTest = false;
@BeforeClass
public static void initClass() {
@@ -80,8 +93,10 @@ public class TestGearsGLJPanelAWT extends UITestCase {
glJPanel.setPreferredSize(glc_sz);
glJPanel.setSize(glc_sz);
glJPanel.addGLEventListener(new Gears());
+ final SnapshotGLEventListener snap = new SnapshotGLEventListener();
+ glJPanel.addGLEventListener(snap);
- FPSAnimator animator = new FPSAnimator(glJPanel, 60);
+ final FPSAnimator animator = useAnimator ? new FPSAnimator(glJPanel, 60) : null;
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -91,20 +106,34 @@ public class TestGearsGLJPanelAWT extends UITestCase {
frame.setVisible(true);
} } ) ;
- animator.setUpdateFPSFrames(1, null);
- animator.start();
- Assert.assertEquals(true, animator.isAnimating());
+ if( useAnimator ) {
+ animator.setUpdateFPSFrames(1, null);
+ animator.start();
+ Assert.assertEquals(true, animator.isAnimating());
+ }
+
+ QuitAdapter quitAdapter = new QuitAdapter();
- while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ snap.setMakeSnapshot();
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
Thread.sleep(100);
+ t1 = System.currentTimeMillis();
}
Assert.assertNotNull(frame);
Assert.assertNotNull(glJPanel);
Assert.assertNotNull(animator);
- animator.stop();
- Assert.assertEquals(false, animator.isAnimating());
+ if( useAnimator ) {
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ }
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(false);
@@ -116,24 +145,89 @@ public class TestGearsGLJPanelAWT extends UITestCase {
}
@Test
- public void test01()
+ public void test01_default()
throws AWTException, InterruptedException, InvocationTargetException
{
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ if(useMSAA) {
+ caps.setNumSamples(4);
+ caps.setSampleBuffers(true);
+ }
+ if(shallUsePBuffer) {
+ caps.setPBuffer(true);
+ }
+ if(shallUseBitmap) {
+ caps.setBitmap(true);
+ }
runTestGL(caps);
}
+ @Test
+ public void test02_msaa()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setNumSamples(4);
+ caps.setSampleBuffers(true);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test03_pbuffer()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setPBuffer(true);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test04_bitmap()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ caps.setBitmap(true);
+ runTestGL(caps);
+ }
+
static long duration = 500; // ms
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
- try {
- duration = Integer.parseInt(args[i]);
- } catch (Exception ex) { ex.printStackTrace(); }
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-vsync")) {
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
+ } else if(args[i].equals("-msaa")) {
+ useMSAA = true;
+ } else if(args[i].equals("-noanim")) {
+ useAnimator = false;
+ } else if(args[i].equals("-pbuffer")) {
+ shallUsePBuffer = true;
+ } else if(args[i].equals("-bitmap")) {
+ shallUseBitmap = true;
+ } else if(args[i].equals("-manual")) {
+ manualTest = true;
}
}
+ System.err.println("swapInterval "+swapInterval);
+ System.err.println("useMSAA "+useMSAA);
+ System.err.println("useAnimator "+useAnimator);
+ System.err.println("shallUsePBuffer "+shallUsePBuffer);
+ System.err.println("shallUseBitmap "+shallUseBitmap);
+ System.err.println("manualTest "+manualTest);
+
org.junit.runner.JUnitCore.main(TestGearsGLJPanelAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
index 44e2eeda7..a81dec874 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
@@ -177,7 +177,7 @@ public abstract class UITestCase {
}
final String dblb = caps.getDoubleBuffered() ? "dbl" : "one";
final String F_pfmt = sinkHasAlpha ? "rgba" : "rgb_";
- final String pfmt = caps.getAlphaBits() > 0 ? "rgba" : "rgb_";
+ final String pfmt = "rgba" + caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits() + caps.getAlphaBits();
final int depthBits = caps.getDepthBits();
final int stencilBits = caps.getStencilBits();
final int samples = caps.getNumSamples() ;
@@ -195,9 +195,9 @@ public abstract class UITestCase {
/**
* Takes a snapshot of the drawable's current front framebuffer. Example filenames:
* <pre>
- * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testES2OffScreenFBOSglBuf____-n0001-msaa0-GLES2_-sw-fbobject-Bdbl-Frgb__Irgb_-D24-St00-Sa00_default-0400x0300.png
- * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testES2OffScreenPbufferDblBuf-n0003-msaa0-GLES2_-sw-pbuffer_-Bdbl-Frgb__Irgb_-D24-St00-Sa00_default-0200x0150.png
- * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testGL2OffScreenPbufferSglBuf-n0003-msaa0-GL2___-hw-pbuffer_-Bone-Frgb__Irgb_-D24-St00-Sa00_default-0200x0150.png
+ * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testES2OffScreenFBOSglBuf____-n0001-msaa0-GLES2_-sw-fbobject-Bdbl-Frgb__Irgba8888_-D24-St00-Sa00_default-0400x0300.png
+ * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testES2OffScreenPbufferDblBuf-n0003-msaa0-GLES2_-sw-pbuffer_-Bdbl-Frgb__Irgba8880-D24-St00-Sa00_default-0200x0150.png
+ * TestGLDrawableAutoDelegateOnOffscrnCapsNEWT.testGL2OffScreenPbufferSglBuf-n0003-msaa0-GL2___-hw-pbuffer_-Bone-Frgb__Irgba5551-D24-St00-Sa00_default-0200x0150.png
* </pre>
* @param sn sequential number
* @param postSNDetail optional detail to be added to the filename after <code>sn</code>