summaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-13 07:00:01 +0100
committerSven Gothel <[email protected]>2012-02-13 07:00:01 +0100
commit4011e70eed8c88aee0fcd051a50ab3f15bb94f68 (patch)
treee7fb1c33d4c0e75fc52dc3ec2d927f76c51de216 /src/test/com
parentddd375375025fb83aba90c80b9a089876dad5434 (diff)
OpenGL ES/EGL Overhaul
- GLProfile properly detects native EGL/ES1/ES2 on the 'desktop' device factory. This allows usage of Mesa's EGL/ES or Imageon's PVR emulation, etc. - GLProfile drops getDefaultDesktopDevice() and getDefaultEGLDevice() since both are aligned by getDefaultDevice(). - Fix GL_ARB_ES2_compatibility detection and utilize resulting isGLES2Compatible() where possible. This allows ES2 compatible desktop profiles to use core ES2 functionality (glShaderBinary() .. etc) even with a GL2ES2 desktop implementation. - EGLDrawable: If createSurface(..) fails (BAD_NATIVE_WINDOW) w/ surfaceHandle it uses windowHandle if available and differs. This allows the ANGLE impl. to work. - Properly order of EGL/ES library lookup: ES2: libGLESv2.so.2, libGLESv2.so, GLES20, GLESv2_CM EGL: libEGL.so.1, libEGL.so, EGL - *DynamicLookupHelper reference will be null if it's library is not complete (all tool libs, all glue libs and a ProcAddressFunc lookup function - if named). - Enhance GL version string (incl. ES2 compatible, hw/sw, ..) - GLBase: Fix docs and remove redundancies - Prepared (disabled) DesktopES2DynamicLibraryBundleInfo to be used for a real EGL/ES2 implementation within the desktop GL lib (AMD). Sadly it currenly crashed within eglGetDisplay(EGL_DEFAULT_DISPLAY), hence it's disabled.
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWT.java93
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java27
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java23
5 files changed, 123 insertions, 35 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java
index 6a5f76ff9..67e4f13fc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -29,7 +29,6 @@
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
-import java.util.List;
import org.junit.Assert;
import org.junit.Test;
@@ -55,18 +54,12 @@ public class TestGLProfile01NEWT extends UITestCase {
System.err.println(JoglVersion.getInstance());
System.err.println(NewtVersion.getInstance());
- GLDrawableFactory factory = GLDrawableFactory.getFactory(GLProfile.getDefault());
- List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null);
- for(int i=0; i<availCaps.size(); i++) {
- System.err.println(availCaps.get(i));
- }
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(null).toString());
}
@Test
public void test01GLProfileDefault() throws InterruptedException {
System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
- System.out.println("GLProfile.getDefaultDesktopDevice(): "+GLProfile.getDefaultDesktopDevice());
- System.out.println("GLProfile.getDefaultEGLDevice(): "+GLProfile.getDefaultEGLDevice());
System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
GLProfile glp = GLProfile.getDefault();
System.out.println("GLProfile.getDefault(): "+glp);
@@ -138,7 +131,7 @@ public class TestGLProfile01NEWT extends UITestCase {
}
protected void dumpVersion(GLProfile glp) throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("TestGLProfile01NEWT");
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWT.java
new file mode 100644
index 000000000..1a0a401bc
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWT.java
@@ -0,0 +1,93 @@
+/**
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+
+import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.DumpGLInfo;
+import com.jogamp.newt.opengl.*;
+
+public class TestGLProfile02NEWT extends UITestCase {
+
+ @Test
+ public void test00Version() throws InterruptedException {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(null).toString());
+ }
+
+ @Test
+ public void test01GLProfileGLES1() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GLES1)) {
+ System.out.println("GLProfile GLES1 n/a");
+ return;
+ }
+ GLProfile glp = GLProfile.get(GLProfile.GLES1);
+ System.out.println("GLProfile GLES1: "+glp);
+ dumpVersion(glp);
+ }
+
+ @Test
+ public void test06GLProfileGLES2() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GLES2)) {
+ System.out.println("GLProfile GLES2 n/a");
+ return;
+ }
+ GLProfile glp = GLProfile.get(GLProfile.GLES2);
+ System.out.println("GLProfile GLES2: "+glp);
+ dumpVersion(glp);
+ }
+
+ protected void dumpVersion(GLProfile glp) throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setTitle("TestGLProfile02NEWT");
+
+ glWindow.addGLEventListener(new DumpGLInfo());
+
+ glWindow.setSize(128, 128);
+ glWindow.setVisible(true);
+
+ glWindow.display();
+ Thread.sleep(100);
+ glWindow.destroy();
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestGLProfile02NEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java
index 284122be3..6a315c67d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java
@@ -125,7 +125,7 @@ public class TestBug461OffscreenSupersamplingSwingAWT extends UITestCase impleme
GLDrawableFactory fac = GLDrawableFactory.getFactory(glp);
Assert.assertNotNull(fac);
- Assert.assertTrue( fac.canCreateGLPbuffer(GLProfile.getDefaultDesktopDevice()) );
+ Assert.assertTrue( fac.canCreateGLPbuffer(GLProfile.getDefaultDevice()) );
GLCapabilities glCap = new GLCapabilities(glp);
Assert.assertNotNull(glCap);
@@ -140,7 +140,7 @@ public class TestBug461OffscreenSupersamplingSwingAWT extends UITestCase impleme
glCap.setStencilBits(1);
//makes a new buffer
- offScreenBuffer = fac.createGLPbuffer(GLProfile.getDefaultDesktopDevice(), glCap, null, 200, 200, null);
+ offScreenBuffer = fac.createGLPbuffer(GLProfile.getDefaultDevice(), glCap, null, 200, 200, null);
Assert.assertNotNull(offScreenBuffer);
offScreenBuffer.addGLEventListener(this);
offScreenBuffer.display();
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 faa7eb311..674009b09 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
@@ -63,9 +63,7 @@ import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
-public class TestGearsES2NEWT extends UITestCase {
- static GLProfile glp;
-
+public class TestGearsES2NEWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
static DimensionImmutable wsize;
@@ -84,14 +82,6 @@ public class TestGearsES2NEWT extends UITestCase {
@BeforeClass
public static void initClass() {
- /*if(GLProfile.isAvailable(GLProfile.getDefaultEGLDevice(), GLProfile.GLES2)) {
- // exact match
- glp = GLProfile.get(GLProfile.getDefaultEGLDevice(), GLProfile.GLES2);
- } else */ {
- // default device, somehow ES2 compatible
- glp = GLProfile.getGL2ES2();
- }
- Assert.assertNotNull(glp);
if(null == wsize) {
wsize = new Dimension(200, 200);
}
@@ -243,8 +233,19 @@ public class TestGearsES2NEWT extends UITestCase {
}
@Test
- public void test01() throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(glp);
+ public void test01GL2ES2() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+ caps.setBackgroundOpaque(opaque);
+ runTestGL(caps, undecorated);
+ }
+
+ @Test
+ public void test02GLES2() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GLES2)) {
+ System.out.println("GLProfile GLES2 n/a");
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
caps.setBackgroundOpaque(opaque);
runTestGL(caps, undecorated);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index f3bad286b..49dbc062a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -47,19 +47,10 @@ import org.junit.AfterClass;
import org.junit.Test;
public class TestRedSquareES2NEWT extends UITestCase {
- static GLProfile glp;
static int width, height;
@BeforeClass
public static void initClass() {
- /* if(GLProfile.isAvailable(GLProfile.getDefaultEGLDevice(), GLProfile.GLES1)) {
- // exact match
- glp = GLProfile.get(GLProfile.getDefaultEGLDevice(), GLProfile.GLES1);
- } else */ {
- // default device, somehow ES1 compatible
- glp = GLProfile.getGL2ES2();
- }
- Assert.assertNotNull(glp);
width = 512;
height = 512;
}
@@ -114,11 +105,21 @@ public class TestRedSquareES2NEWT extends UITestCase {
}
@Test
- public void test01() throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(glp);
+ public void test01GL2ES2() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
runTestGL(caps);
}
+ @Test
+ public void test02GLES2() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GLES2)) {
+ System.out.println("GLProfile GLES2 n/a");
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ runTestGL(caps);
+ }
+
static long duration = 500; // ms
public static void main(String args[]) {