aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-12-21 22:03:47 +0100
committerSven Gothel <[email protected]>2013-12-21 22:03:47 +0100
commit3d0ab3e6263dfdbb9dd0014443ad28b1c9b0c238 (patch)
tree6fc44cf4616767fe255a61cc701dc6ef0242cf52 /src
parentddd5eb35b83ca85dbf43039e8199a7ecf011cdd8 (diff)
Bug 929 - Reflect ES3 Compatibility with ES2
- Map ES2 -> ES3 GLProfile, if available - EGLDrawableFactory: Don't query ES2 if ES3 is available - Fix queries and get methods (GL, GLContext and GLProfile): - glES3.isGLES2()==true and glES3.getGLES2()!=null - ctxES3.isGLES2()==true, - glES3Profile.isGLES2()==true - Enhance Unit test: TestGLProfile01NEWT - Test all GLProfile availability combinations based on implementing GLProfile - Test all GLProfile's isGL*() based on highest GLProfile identity - Test all GL's isGL*() based on highest GL identity.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java277
6 files changed, 252 insertions, 87 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index deb1d7587..bec62c30d 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1109,11 +1109,15 @@ public abstract class GLContext {
}
/**
- * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2 ].</p>
+ * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2, GLES3 ].</p>
* @see GLProfile#isGLES2()
*/
public final boolean isGLES2() {
- return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 2 ;
+ if( 0 != ( ctxOptions & CTX_PROFILE_ES ) ) {
+ final int major = ctxVersion.getMajor();
+ return 2 == major || 3 == major;
+ }
+ return false;
}
/**
@@ -1121,7 +1125,7 @@ public abstract class GLContext {
* @see GLProfile#isGLES3()
*/
public final boolean isGLES3() {
- return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ;
+ return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 3 ;
}
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 64c8a6243..1f9460f5d 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1147,9 +1147,9 @@ public class GLProfile {
return GLES1 == profile;
}
- /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES2 ].</p> */
+ /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES2, GLES3 ].</p> */
public final boolean isGLES2() {
- return GLES2 == profile;
+ return isGLES3() || GLES2 == profile;
}
/** Indicates whether this profile is capable of GLES3. <p>Includes [ GLES3 ].</p> */
@@ -1157,7 +1157,7 @@ public class GLProfile {
return GLES3 == profile;
}
- /** Indicates whether this profile is capable of GLES. <p>Includes [ GLES3, GLES1, GLES2 ].</p> */
+ /** Indicates whether this profile is capable of GLES. <p>Includes [ GLES1, GLES2, GLES3 ].</p> */
public final boolean isGLES() {
return GLES3 == profile || GLES2 == profile || GLES1 == profile;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 967b88358..f89ded4f6 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -319,27 +319,23 @@ public class EGLContext extends GLContextImpl {
}
mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]);
}
- /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, final int major) {
- int ctp = GLContext.CTX_PROFILE_ES;
- if( major >= 3 ) {
- ctp |= GLContext.CTX_IMPL_ES3_COMPAT | GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ;
- } else if( major >= 2 ) {
- ctp |= GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ;
- }
- mapStaticGLVersion(device, major, 0, ctp);
- }
/* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) {
if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) {
- // ES1 or ES2
- final int reqMajor = major;
- final int reqProfile = GLContext.CTX_PROFILE_ES;
- GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp);
- if(! ( device instanceof EGLGraphicsDevice ) ) {
- final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null);
- GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp);
+ // ES1, ES2, ES3, ..
+ mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp);
+ if( 3 == major ) {
+ // map ES2 -> ES3
+ mapStaticGLVersion(device, 2 /* reqMajor */, major, minor, ctp);
}
}
}
+ private static void mapStaticGLVersion(AbstractGraphicsDevice device, int reqMajor, int major, int minor, int ctp) {
+ GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp);
+ if(! ( device instanceof EGLGraphicsDevice ) ) {
+ final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null);
+ GLContext.mapAvailableGLVersion(eglDevice, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp);
+ }
+ }
protected static String getGLVersion(int major, int minor, int ctp, String gl_version) {
return GLContext.getGLVersion(major, minor, ctp, gl_version);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 3c8531730..1ff16fff8 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -624,13 +624,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
// ES3 Query
final int[] esProfile = { 3 };
madeCurrentES3 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) && 3 == esProfile[0];
- // ES2 Query, may result in ES3
- esProfile[0] = 2;
- if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) {
- switch( esProfile[0] ) {
- case 2: madeCurrentES2 = true; break;
- case 3: madeCurrentES3 = true; break;
- default: throw new InternalError("XXXX Got "+esProfile[0]);
+ if( !madeCurrentES3 ) {
+ // ES2 Query, may result in ES3
+ esProfile[0] = 2;
+ if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) {
+ switch( esProfile[0] ) {
+ case 2: madeCurrentES2 = true; break;
+ case 3: madeCurrentES3 = true; break;
+ default: throw new InternalError("XXXX Got "+esProfile[0]);
+ }
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 0d231b89d..259c70641 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -291,7 +291,7 @@ public class MacOSXCGLContext extends GLContextImpl
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
final GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
final GLProfile glp = capabilitiesChosen.getGLProfile();
- if( glp.isGLES1() || glp.isGLES2() || glp.isGLES3() ||
+ if( glp.isGLES() ||
( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
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 462934c92..42fde4b49 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,184 +20,347 @@
* 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.opengl.GL;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
import org.junit.Assert;
-import org.junit.Test;
import org.junit.FixMethodOrder;
+import org.junit.Test;
import org.junit.runners.MethodSorters;
-import javax.media.opengl.*;
-
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.util.VersionUtil;
import com.jogamp.nativewindow.NativeWindowVersion;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.DumpGLInfo;
+import com.jogamp.newt.NewtVersion;
+import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
-import com.jogamp.newt.opengl.*;
-import com.jogamp.newt.*;
+import com.jogamp.opengl.test.junit.util.UITestCase;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLProfile01NEWT extends UITestCase {
@Test
- public void testVersion() throws InterruptedException {
+ public void test00Version() throws InterruptedException {
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
System.err.println(NativeWindowVersion.getInstance());
System.err.println(JoglVersion.getInstance());
System.err.println(NewtVersion.getInstance());
- System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, true).toString());
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(GLDrawableFactory.getDesktopFactory().getDefaultDevice(), null, true).toString());
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(GLDrawableFactory.getEGLFactory().getDefaultDevice(), null, true).toString());
}
- @Test
- public void testGLProfileDefault() throws InterruptedException {
- System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
- System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
- GLProfile glp = GLProfile.getDefault();
- System.out.println("GLProfile.getDefault(): "+glp);
- if(glp.getName().equals(GLProfile.GL4bc)) {
+ static void validate(GLProfile glp) {
+ if( glp.getImplName().equals(GLProfile.GL4bc) ) {
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4bc));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- } else if(glp.getName().equals(GLProfile.GL3bc)) {
+ } else if(glp.getImplName().equals(GLProfile.GL3bc)) {
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- } else if(glp.getName().equals(GLProfile.GL2)) {
+ } else if(glp.getImplName().equals(GLProfile.GL2)) {
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- } else if(glp.getName().equals(GLProfile.GL2ES1)) {
+ } else if(glp.getImplName().equals(GLProfile.GL4)) {
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
+ } else if(glp.getImplName().equals(GLProfile.GL3)) {
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
+ } else if(glp.getImplName().equals(GLProfile.GLES3)) {
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
+ } else if(glp.getImplName().equals(GLProfile.GLES2)) {
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES2));
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
+ } else if(glp.getImplName().equals(GLProfile.GLES1)) {
+ Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES1));
Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1));
}
+ if( glp.isGL4bc() ) {
+ Assert.assertTrue(glp.isGL4());
+ Assert.assertTrue(glp.isGL3bc());
+ Assert.assertTrue(glp.isGL3());
+ Assert.assertTrue(glp.isGL2());
+ Assert.assertTrue(glp.isGL2GL3());
+ Assert.assertTrue(glp.isGL4ES3());
+ Assert.assertTrue(glp.isGL3ES3());
+ Assert.assertTrue(glp.isGL2ES1());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGL3bc()) {
+ Assert.assertTrue(glp.isGL3());
+ Assert.assertTrue(glp.isGL2());
+ Assert.assertTrue(glp.isGL2GL3());
+ Assert.assertTrue(glp.isGL2ES1());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGL2()) {
+ Assert.assertTrue(glp.isGL2GL3());
+ Assert.assertTrue(glp.isGL2ES1());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGL4()) {
+ Assert.assertTrue(glp.isGL3());
+ Assert.assertTrue(glp.isGL2GL3());
+ Assert.assertTrue(glp.isGL4ES3());
+ Assert.assertTrue(glp.isGL3ES3());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGL3()) {
+ Assert.assertTrue(glp.isGL2GL3());
+ Assert.assertTrue(glp.isGL3ES3());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGLES3()) {
+ Assert.assertTrue(glp.isGL4ES3());
+ Assert.assertTrue(glp.isGL3ES3());
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGLES2()) {
+ Assert.assertTrue(glp.isGL2ES2());
+ } else if(glp.isGLES1()) {
+ Assert.assertTrue(glp.isGL2ES1());
+ }
+ }
+
+ static void validate(GL gl) {
+ if( gl.isGL4bc() ) {
+ Assert.assertTrue(gl.isGL4());
+ Assert.assertTrue(gl.isGL3bc());
+ Assert.assertTrue(gl.isGL3());
+ Assert.assertTrue(gl.isGL2());
+ Assert.assertTrue(gl.isGL2GL3());
+ Assert.assertTrue(gl.isGL4ES3());
+ Assert.assertTrue(gl.isGL3ES3());
+ Assert.assertTrue(gl.isGL2ES1());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGL3bc()) {
+ Assert.assertTrue(gl.isGL3());
+ Assert.assertTrue(gl.isGL2());
+ Assert.assertTrue(gl.isGL2GL3());
+ Assert.assertTrue(gl.isGL2ES1());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGL2()) {
+ Assert.assertTrue(gl.isGL2GL3());
+ Assert.assertTrue(gl.isGL2ES1());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGL4()) {
+ Assert.assertTrue(gl.isGL3());
+ Assert.assertTrue(gl.isGL2GL3());
+ Assert.assertTrue(gl.isGL4ES3());
+ Assert.assertTrue(gl.isGL3ES3());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGL3()) {
+ Assert.assertTrue(gl.isGL2GL3());
+ Assert.assertTrue(gl.isGL3ES3());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGLES3()) {
+ Assert.assertTrue(gl.isGL4ES3());
+ Assert.assertTrue(gl.isGL3ES3());
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGLES2()) {
+ Assert.assertTrue(gl.isGL2ES2());
+ } else if(gl.isGLES1()) {
+ Assert.assertTrue(gl.isGL2ES1());
+ }
+
+ final GLContext ctx = gl.getContext();
+ if( ctx.isGL4bc() ) {
+ Assert.assertTrue(ctx.isGL4());
+ Assert.assertTrue(ctx.isGL3bc());
+ Assert.assertTrue(ctx.isGL3());
+ Assert.assertTrue(ctx.isGL2());
+ Assert.assertTrue(ctx.isGL2GL3());
+ Assert.assertTrue(ctx.isGL4ES3());
+ Assert.assertTrue(ctx.isGL3ES3());
+ Assert.assertTrue(ctx.isGL2ES1());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGL3bc()) {
+ Assert.assertTrue(ctx.isGL3());
+ Assert.assertTrue(ctx.isGL2());
+ Assert.assertTrue(ctx.isGL2GL3());
+ Assert.assertTrue(ctx.isGL2ES1());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGL2()) {
+ Assert.assertTrue(ctx.isGL2GL3());
+ Assert.assertTrue(ctx.isGL2ES1());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGL4()) {
+ Assert.assertTrue(ctx.isGL3());
+ Assert.assertTrue(ctx.isGL2GL3());
+ Assert.assertTrue(ctx.isGL4ES3());
+ Assert.assertTrue(ctx.isGL3ES3());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGL3()) {
+ Assert.assertTrue(ctx.isGL2GL3());
+ Assert.assertTrue(ctx.isGL3ES3());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGLES3()) {
+ Assert.assertTrue(ctx.isGL4ES3());
+ Assert.assertTrue(ctx.isGL3ES3());
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGLES2()) {
+ Assert.assertTrue(ctx.isGL2ES2());
+ } else if(ctx.isGLES1()) {
+ Assert.assertTrue(ctx.isGL2ES1());
+ }
+ }
+
+ @Test
+ public void test01GLProfileDefault() throws InterruptedException {
+ System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
+ System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
+ GLProfile glp = GLProfile.getDefault();
+ System.out.println("GLProfile.getDefault(): "+glp);
+ validate(glp);
dumpVersion(glp);
}
@Test
- public void testGLProfileMaxProgrammable() throws InterruptedException {
+ public void test02GLProfileMaxProgrammable() throws InterruptedException {
// Assuming at least one programmable profile is available
GLProfile glp = GLProfile.getMaxProgrammable(true);
System.out.println("GLProfile.getMaxProgrammable(): "+glp);
- if(glp.getName().equals(GLProfile.GL4)) {
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4));
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3));
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- } else if(glp.getName().equals(GLProfile.GL3)) {
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3));
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- } else if(glp.getName().equals(GLProfile.GL2ES2)) {
- Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2));
- }
+ validate(glp);
dumpVersion(glp);
}
@Test
- public void testGLProfileGL2ES1() throws InterruptedException {
+ public void test03GLProfileMaxFixedFunc() throws InterruptedException {
+ // Assuming at least one fixed function profile is available
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
+ validate(glp);
+ dumpVersion(glp);
+ }
+
+ @Test
+ public void test04GLProfileGL2ES1() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GL2ES1)) {
System.out.println("GLProfile GL2ES1 n/a");
return;
}
GLProfile glp = GLProfile.getGL2ES1();
System.out.println("GLProfile GL2ES1: "+glp);
+ validate(glp);
dumpVersion(glp);
}
@Test
- public void testGLProfileGL2ES2() throws InterruptedException {
+ public void test05GLProfileGL2ES2() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GL2ES2)) {
System.out.println("GLProfile GL2ES2 n/a");
return;
}
GLProfile glp = GLProfile.getGL2ES2();
System.out.println("GLProfile GL2ES2: "+glp);
+ validate(glp);
dumpVersion(glp);
}
@Test
- public void testGLProfileGL4ES3() throws InterruptedException {
+ public void test06GLProfileGL4ES3() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GL4ES3)) {
System.out.println("GLProfile GL4ES3 n/a");
return;
}
GLProfile glp = GLProfile.getGL4ES3();
System.out.println("GLProfile GL4ES3: "+glp);
+ validate(glp);
dumpVersion(glp);
}
-
+
void testSpecificProfile(String glps) throws InterruptedException {
if(GLProfile.isAvailable(glps)) {
GLProfile glp = GLProfile.get(glps);
+ validate(glp);
dumpVersion(glp);
} else {
System.err.println("Profile "+glps+" n/a");
}
}
-
+
@Test
- public void testGL4bc() throws InterruptedException {
+ public void test10_GL4bc() throws InterruptedException {
testSpecificProfile(GLProfile.GL4bc);
}
@Test
- public void testGL3bc() throws InterruptedException {
+ public void test11_GL3bc() throws InterruptedException {
testSpecificProfile(GLProfile.GL3bc);
}
@Test
- public void testGL2() throws InterruptedException {
+ public void test12_GL2() throws InterruptedException {
testSpecificProfile(GLProfile.GL2);
}
-
+
@Test
- public void testGL4() throws InterruptedException {
+ public void test13_GL4() throws InterruptedException {
testSpecificProfile(GLProfile.GL4);
}
@Test
- public void testGL3() throws InterruptedException {
+ public void test14_GL3() throws InterruptedException {
testSpecificProfile(GLProfile.GL3);
}
@Test
- public void testGLES1() throws InterruptedException {
+ public void test15_GLES1() throws InterruptedException {
testSpecificProfile(GLProfile.GLES1);
}
@Test
- public void testGLES2() throws InterruptedException {
+ public void test16_GLES2() throws InterruptedException {
testSpecificProfile(GLProfile.GLES2);
}
-
+
@Test
- public void testGLES3() throws InterruptedException {
+ public void test17_GLES3() throws InterruptedException {
testSpecificProfile(GLProfile.GLES3);
}
-
+
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");
- glWindow.addGLEventListener(new DumpGLInfo());
glWindow.addGLEventListener(new GLEventListener() {
-
+
public void init(GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
+ System.err.println(JoglVersion.getGLStrings(gl, null, false));
+
+ validate(gl);
+
final GLProfile glp = gl.getGLProfile();
System.err.println("GL impl. class "+gl.getClass().getName());
if( gl.isGL4() ) {
@@ -237,13 +400,13 @@ public class TestGLProfile01NEWT extends UITestCase {
System.err.println("GL Mapping "+glp+" -> GL2ES1");
}
}
-
+
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
-
+
public void display(GLAutoDrawable drawable) {
}
-
+
public void dispose(GLAutoDrawable drawable) {
}
});