aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-20 11:46:26 +0200
committerSven Gothel <[email protected]>2010-04-20 11:46:26 +0200
commit32790c376583beccd030eecd7c56cbe66d380172 (patch)
tree894613c7fc6a598aed59db87e5812ef6a44b83dd /src/junit
parentaa7084700bbf74d8bcc98cf0239f57cff2983423 (diff)
JOGL GL4 preperation (cont):
- All available OpenGL versions (native/platform) are verified at GLProfile initialization and can be queried .. A mapping of major,compat -> major,minor,options is created. - Removal of temp context creation, when creating a context. This was necessary to query general availability of ARB_create_context. Due to the shared context of X11GLXDrawableFactory and WindowsWGLDrawableFactory, this is no more necessary. Due to the version mapping, the ARB_create_context paramters are known. - NativeWindow X11Lib: Added X11ErrorHandler, throwing a RuntimeException. Necessary to catch BadMatch .. etc X11 errors, eg for glXCreateContextAttribsARB Hence all X11 calls are covered now. - X11DummyGLXDrawable needs to use an own Window, otherwise GLn n>2 fails - Flattening the desktop GL* implementation, all use GL4bcImpl, which reduces the footprint dramatically. - GL*Impl.isGL*() (desktop) utilizes the GLContext.isGL*(), hence the results reflect the actual native context version. - GLContextImpl makeCurrent/create: Added workflow documentation, clarified code, defined abstract methods to have a protocol. - Removed moved files (from here to gluegen), see gluegen a01cb3d59715a41153380f1977ec75263b762dc6 - NativeLibLoader -> <TYPE>JNILibLoader - Fixed Exception Handling (as in gluegen bce53b52c8638729750c4286dbc04cb14329fd34), ie removed empty catch Throwable .. - GLContext.setSwapInterval(): Nop in offscreen case, otherwise X11IOError (NVIDIA Bug) Test: Tests - Junit - demos.gears.Gears - demos.jrefract.JRefract Platforms - Linux 64/32 ATI/NVidia - MacOsX - Windows (virtualbox 3.1.6, offscreen failed) TODO/BUGS: - FIXME ATI GLn n>2 with AWT, can't make context current, works well on NVIDIA though - FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available! - Add GL 3.3 to GL3/gl3ext.h - Add GL 4.0 to GL3/gl3ext.h and fix the GL3/GL4 seperation - Rename jogl.gl2.jar -> jogl.gldesktop.jar (as done with it's native lib already)
Diffstat (limited to 'src/junit')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java95
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java106
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java39
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java2
4 files changed, 228 insertions, 14 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
new file mode 100755
index 000000000..a1ff0d860
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.acore;
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+public class TestGLProfile01CORE {
+ static GLProfile glp;
+ static GLDrawableFactory factory;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ factory = GLDrawableFactory.getFactory(glp);
+ Assert.assertNotNull(factory);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ factory.shutdown();
+ factory=null;
+ }
+
+ @Test
+ public void test01GLProfileDefault() {
+ System.out.println("GLProfile <static> "+GLProfile.glAvailabilityToString());
+ }
+
+ @Test
+ public void test02GLProfileMaxFixedFunc() {
+ System.out.println("GLProfile <static> getMaxFixedFunc(): "+GLProfile.getMaxFixedFunc());
+ }
+
+ @Test
+ public void test02GLProfileMaxProgrammable() {
+ System.out.println("GLProfile <static> getMaxProgrammable(): "+GLProfile.getMaxProgrammable());
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestGLProfile01CORE.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
new file mode 100755
index 000000000..ac34b46b5
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.awt;
+
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+import java.awt.Frame;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Test;
+
+public class TestAWT01GLn {
+ Frame frame=null;
+ GLCanvas glCanvas=null;
+
+ @Before
+ public void init() {
+ frame = new Frame("Texture Test");
+ Assert.assertNotNull(frame);
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas);
+ frame.setVisible(false);
+ frame.remove(glCanvas);
+ frame.dispose();
+ frame=null;
+ glCanvas=null;
+ }
+
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException {
+ glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ frame.add(glCanvas);
+ frame.setSize(512, 512);
+
+ glCanvas.addGLEventListener(new Gears());
+
+ Animator animator = new Animator(glCanvas);
+ frame.setVisible(true);
+ animator.start();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
+ }
+
+ @Test
+ public void test01GLDefault() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ runTestGL(caps);
+ }
+
+ /** Both fail on ATI .. if GLn n>2
+ public void test02GL3bc() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3bc));
+ runTestGL(caps);
+ }
+
+ public void test03GLMaxFixed() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc());
+ runTestGL(caps);
+ } */
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestAWT01GLn.class.getName());
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index ec03bec95..459b41f16 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -55,16 +55,16 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import java.io.IOException;
public class TestOffscreen01NEWT {
- static GLProfile glp;
+ static GLProfile glpDefault;
static GLDrawableFactory factory;
static int width, height;
- GLCapabilities caps;
+ GLCapabilities capsDefault;
@BeforeClass
public static void initClass() {
- glp = GLProfile.getDefault();
- Assert.assertNotNull(glp);
- factory = GLDrawableFactory.getFactory(glp);
+ glpDefault = GLProfile.getDefault();
+ Assert.assertNotNull(glpDefault);
+ factory = GLDrawableFactory.getFactory(glpDefault);
Assert.assertNotNull(factory);
width = 640;
height = 480;
@@ -78,7 +78,8 @@ public class TestOffscreen01NEWT {
@Before
public void init() {
- caps = new GLCapabilities(glp);
+ capsDefault = new GLCapabilities(glpDefault);
+ Assert.assertNotNull(capsDefault);
}
private void do01OffscreenWindowPBuffer(GLCapabilities caps) {
@@ -115,20 +116,20 @@ public class TestOffscreen01NEWT {
@Test
public void test01aOffscreenWindowPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
do01OffscreenWindowPBuffer(caps2);
}
@Test
public void test01bOffscreenWindowPBufferStencil() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setStencilBits(8);
do01OffscreenWindowPBuffer(caps2);
}
@Test
public void test01cOffscreenWindowPBufferStencilAlpha() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setStencilBits(8);
caps2.setAlphaBits(8);
do01OffscreenWindowPBuffer(caps2);
@@ -136,7 +137,7 @@ public class TestOffscreen01NEWT {
@Test
public void test01cOffscreenWindowPBuffer555() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setRedBits(5);
caps2.setGreenBits(5);
caps2.setBlueBits(5);
@@ -145,7 +146,7 @@ public class TestOffscreen01NEWT {
@Test
public void test02Offscreen3Windows1DisplayPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
int winnum = 3, i;
Window windows[] = new Window[winnum];
GLWindow glWindows[] = new GLWindow[winnum];
@@ -192,7 +193,7 @@ public class TestOffscreen01NEWT {
@Test
public void test03Offscreen3Windows3DisplaysPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
int winnum = 3, i;
Display displays[] = new Display[winnum];
Screen screens[] = new Screen[winnum];
@@ -240,7 +241,7 @@ public class TestOffscreen01NEWT {
@Test
public void test04OffscreenSnapshotWithDemoPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
System.out.println("Create Window 1");
Display display = NewtFactory.createDisplay(null); // local display
@@ -283,6 +284,12 @@ public class TestOffscreen01NEWT {
@Test
public void test11OffscreenWindowPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
Display display = NewtFactory.createDisplay(null); // local display
@@ -318,6 +325,12 @@ public class TestOffscreen01NEWT {
@Test
public void test14OffscreenSnapshotWithDemoPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
System.out.println("Create Window 1");
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
index 563c7f88e..4bbbaa271 100755
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -93,7 +93,7 @@ public class TestTexture01AWT {
frame.setVisible(true);
animator.start();
- Thread.sleep(1000); // 1000 ms
+ Thread.sleep(500); // 500 ms
animator.stop();
frame.setVisible(false);