aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java14
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java45
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java85
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java5
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java70
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java69
6 files changed, 224 insertions, 64 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index 3e578dc68..f1853351f 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -174,7 +174,8 @@ public interface GLBase {
public boolean isGL3ES3();
/**
- * Indicates whether this GL object conforms to a GL4ES3 compatible profile.
+ * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
+ * <p>Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p>
* @see GLContext#isGL4ES3()
*/
public boolean isGL4ES3();
@@ -213,8 +214,13 @@ public interface GLBase {
/**
* Indicates whether this GL object is compatible with the core OpenGL ES3 functionality.
- * @return true if this context is an ES3 context or implements
- * the extension <code>GL_ARB_ES3_compatibility</code>, otherwise false
+ * <p>
+ * Return true if the underlying context is an ES3 context or implements
+ * the extension <code>GL_ARB_ES3_compatibility</code>, otherwise false.
+ * </p>
+ * <p>
+ * Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
+ * </p>
* @see GLContext#isGLES3Compatible()
*/
public boolean isGLES3Compatible();
@@ -319,7 +325,7 @@ public interface GLBase {
/**
* Casts this object to the GL4ES3 interface.
- * @throws GLException if this object is not a GL3ES3 implementation
+ * @throws GLException if this object is not a GL4ES3 implementation
*/
public GL4ES3 getGL4ES3() throws GLException;
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index c3e82e6ee..0cf04d119 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -140,6 +140,9 @@ public abstract class GLContext {
/** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
public static final VersionNumber Version320 = new VersionNumber(3, 2, 0);
+ /** Version 4.3. As an OpenGL version, it qualifies for <code>GL_ARB_ES3_compatibility</code> */
+ public static final VersionNumber Version430 = new VersionNumber(4, 3, 0);
+
protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
//
@@ -822,8 +825,11 @@ public abstract class GLContext {
}
/**
- * @return true if this context is an ES3 context or implements
- * the extension <code>GL_ARB_ES3_compatibility</code>, otherwise false
+ * Return true if this context is an ES3 context or implements
+ * the extension <code>GL_ARB_ES3_compatibility</code>, otherwise false.
+ * <p>
+ * Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
+ * </p>
*/
public final boolean isGLES3Compatible() {
return 0 != ( ctxOptions & CTX_IMPL_ES3_COMPAT ) ;
@@ -1115,11 +1121,12 @@ public abstract class GLContext {
}
/**
- * Indicates whether this profile is capable of GL4ES3. <p>Includes [ GL4bc, GL4, GLES3 ].</p>
- * @see GLProfile#isGL4ES3()
+ * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true.
+ * <p>Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p>
+ * @see GLProfile#isGL4ES3()
*/
public final boolean isGL4ES3() {
- return isGL4() || isGLES3() ;
+ return isGLES3Compatible() ;
}
/**
@@ -1598,9 +1605,9 @@ public abstract class GLContext {
*/
protected static final void getRequestMajorAndCompat(final GLProfile glp, int[/*2*/] reqMajorCTP) {
final GLProfile glpImpl = glp.getImpl();
- if(glpImpl.isGL4()) {
+ if( glpImpl.isGL4() ) {
reqMajorCTP[0]=4;
- } else if (glpImpl.isGL3()) {
+ } else if ( glpImpl.isGL3() || glpImpl.isGLES3() ) {
reqMajorCTP[0]=3;
} else if (glpImpl.isGLES1()) {
reqMajorCTP[0]=1;
@@ -1729,6 +1736,30 @@ public abstract class GLContext {
return isGLVersionAvailable(device, 3, GLContext.CTX_PROFILE_ES, isHardware);
}
+ /**
+ * Returns true if a ES3 compatible profile is available,
+ * i.e. either a &ge; 4.3 context or a &ge; 3.1 context supporting <code>GL_ARB_ES3_compatibility</code>,
+ * otherwise false.
+ * <p>
+ * Includes [ GL4 &gt; 4.3, GL3 &gt; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ].
+ * </p>
+ */
+ public static final boolean isGLES3CompatibleAvailable(AbstractGraphicsDevice device) {
+ int major[] = { 0 };
+ int minor[] = { 0 };
+ int ctp[] = { 0 };
+ boolean ok;
+
+ ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp);
+ if( !ok ) {
+ ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_COMPAT, major, minor, ctp);
+ }
+ if( !ok ) {
+ ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp);
+ }
+ return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT );
+ }
+
public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) {
return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index c2a24e975..51b822449 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -299,13 +299,6 @@ public class GLProfile {
}
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4ES3").append(indent);
- } else {
- sb.append(", GL4ES3 ");
- }
- sb.append(isAvailableImpl(map, GL4ES3));
-
- if(useIndent) {
doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES3").append(indent);
} else {
sb.append(", GLES3 ");
@@ -350,13 +343,6 @@ public class GLProfile {
}
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES2").append(indent);
- } else {
- sb.append(", GL2ES2 ");
- }
- sb.append(isAvailableImpl(map, GL2ES2));
-
- if(useIndent) {
doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES2").append(indent);
} else {
sb.append(", GLES2 ");
@@ -368,13 +354,6 @@ public class GLProfile {
}
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES1").append(indent);
- } else {
- sb.append(", GL2ES1 ");
- }
- sb.append(isAvailableImpl(map, GL2ES1));
-
- if(useIndent) {
doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES1").append(indent);
} else {
sb.append(", GLES1 ");
@@ -386,6 +365,27 @@ public class GLProfile {
}
if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4ES3").append(indent);
+ } else {
+ sb.append(", GL4ES3 ");
+ }
+ sb.append(isAvailableImpl(map, GL4ES3));
+
+ if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES2").append(indent);
+ } else {
+ sb.append(", GL2ES2 ");
+ }
+ sb.append(isAvailableImpl(map, GL2ES2));
+
+ if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES1").append(indent);
+ } else {
+ sb.append(", GL2ES1 ");
+ }
+ sb.append(isAvailableImpl(map, GL2ES1));
+
+ if(useIndent) {
indentCount--;
doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Profiles");
indentCount++;
@@ -1922,24 +1922,37 @@ public class GLProfile {
return GLES2;
}
} else if (GL4ES3.equals(profile)) {
- final boolean es3HardwareRasterizer[] = new boolean[1];
- final boolean gles3Available = hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, es3HardwareRasterizer) );
- final boolean gles3HWAvailable = gles3Available && es3HardwareRasterizer[0] ;
- if(hasGL234Impl) {
- if(GLContext.isGL4Available(device, isHardwareRasterizer)) {
- if(!gles3HWAvailable || isHardwareRasterizer[0]) {
- return GL4;
+ final boolean gles3CompatAvail = GLContext.isGLES3CompatibleAvailable(device);
+ if( desktopCtxUndef || esCtxUndef || gles3CompatAvail ) {
+ final boolean es3HardwareRasterizer[] = new boolean[1];
+ final boolean gles3Available = hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, es3HardwareRasterizer) );
+ final boolean gles3HWAvailable = gles3Available && es3HardwareRasterizer[0] ;
+ if(hasGL234Impl) {
+ if(GLContext.isGL4Available(device, isHardwareRasterizer)) {
+ if(!gles3HWAvailable || isHardwareRasterizer[0]) {
+ return GL4;
+ }
}
- }
- if(GLContext.isGL4bcAvailable(device, isHardwareRasterizer)) {
- if(!gles3HWAvailable || isHardwareRasterizer[0]) {
- return GL4bc;
+ if( GLContext.isGL4bcAvailable(device, isHardwareRasterizer)) {
+ if(!gles3HWAvailable || isHardwareRasterizer[0]) {
+ return GL4bc;
+ }
+ }
+ if(GLContext.isGL3Available(device, isHardwareRasterizer)) {
+ if(!gles3HWAvailable || isHardwareRasterizer[0]) {
+ return GL3;
+ }
+ }
+ if( desktopCtxUndef || GLContext.isGL3bcAvailable(device, isHardwareRasterizer)) {
+ if(!gles3HWAvailable || isHardwareRasterizer[0]) {
+ return GL3bc;
+ }
}
}
- }
- if(gles3Available) {
- isHardwareRasterizer[0] = es3HardwareRasterizer[0];
- return GLES3;
+ if(gles3Available) {
+ isHardwareRasterizer[0] = es3HardwareRasterizer[0];
+ return GLES3;
+ }
}
} else if(GL2GL3.equals(profile)) {
if(hasGL234Impl) {
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 5da60597e..6f4f6f271 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1536,7 +1536,10 @@ public abstract class GLContextImpl extends GLContext {
ctxProfileBits |= CTX_IMPL_ES2_COMPAT;
ctxProfileBits |= CTX_IMPL_FBO;
}
- } else if( isExtensionAvailable( GLExtensions.ARB_ES3_compatibility ) ) {
+ } else if( ( major > 4 || major == 4 && minor >= 3 ) ||
+ ( ( major > 3 || major == 3 && minor >= 1 ) && isExtensionAvailable( GLExtensions.ARB_ES3_compatibility ) ) ) {
+ // See GLContext.isGLES3CompatibleAvailable(..)/isGLES3Compatible()
+ // Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ;
ctxProfileBits |= CTX_IMPL_FBO;
} else if( isExtensionAvailable( GLExtensions.ARB_ES2_compatibility ) ) {
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 537b32355..e85d67dea 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -49,6 +49,8 @@ import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.FPSCounter;
import javax.media.opengl.GL;
+import javax.media.opengl.GL3;
+import javax.media.opengl.GL4ES3;
import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
@@ -56,6 +58,8 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLES2;
+import javax.media.opengl.GLES3;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
@@ -830,23 +834,38 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
* A most simple JOGL AWT test entry
*/
public static void main(String args[]) {
- boolean forceES2 = false;
- boolean forceES3 = false;
- boolean forceGL3 = false;
- if( null != args ) {
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-es2")) {
- forceES2 = true;
- } else if(args[i].equals("-es3")) {
- forceES3 = true;
- } else if(args[i].equals("-gl3")) {
- forceGL3 = true;
- }
+ final boolean forceES2;
+ final boolean forceES3;
+ final boolean forceGL3;
+ final boolean forceGL4ES3;
+ {
+ boolean _forceES2 = false;
+ boolean _forceES3 = false;
+ boolean _forceGL3 = false;
+ boolean _forceGL4ES3 = false;
+ if( null != args ) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-es2")) {
+ _forceES2 = true;
+ } else if(args[i].equals("-es3")) {
+ _forceES3 = true;
+ } else if(args[i].equals("-gl3")) {
+ _forceGL3 = true;
+ } else if(args[i].equals("-gl4es3")) {
+ _forceGL4ES3 = true;
+ }
+ }
}
+ forceES2 = _forceES2;
+ forceES3 = _forceES3;
+ forceGL3 = _forceGL3;
+ forceGL4ES3 = _forceGL4ES3;
}
- System.err.println("forceES2 "+forceES2);
- System.err.println("forceES3 "+forceES3);
- System.err.println("forceGL3 "+forceGL3);
+ System.err.println("forceES2 "+forceES2);
+ System.err.println("forceES3 "+forceES3);
+ System.err.println("forceGL3 "+forceGL3);
+ System.err.println("forceGL4ES3 "+forceGL4ES3);
+
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
System.err.println(JoglVersion.getInstance());
@@ -854,7 +873,9 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, true).toString());
final GLProfile glp;
- if(forceGL3) {
+ if(forceGL4ES3) {
+ glp = GLProfile.get(GLProfile.GL4ES3);
+ } else if(forceGL3) {
glp = GLProfile.get(GLProfile.GL3);
} else if(forceES3) {
glp = GLProfile.get(GLProfile.GLES3);
@@ -876,6 +897,23 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
System.err.println(JoglVersion.getGLInfo(gl, null));
System.err.println("Requested: "+drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities());
System.err.println("Chosen : "+drawable.getChosenGLCapabilities());
+ System.err.println("GL impl. class "+gl.getClass().getName());
+ if( gl.isGL4ES3() ) {
+ GL4ES3 _gl = gl.getGL4ES3();
+ System.err.println("GL4ES3 retrieved, impl. class "+_gl.getClass().getName());
+ }
+ if( gl.isGL3() ) {
+ GL3 _gl = gl.getGL3();
+ System.err.println("GL3 retrieved, impl. class "+_gl.getClass().getName());
+ }
+ if( gl.isGLES3() ) {
+ GLES3 _gl = gl.getGLES3();
+ System.err.println("GLES3 retrieved, impl. class "+_gl.getClass().getName());
+ }
+ if( gl.isGLES2() ) {
+ GLES2 _gl = gl.getGLES2();
+ System.err.println("GLES2 retrieved, impl. class "+_gl.getClass().getName());
+ }
}
@Override
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 d9429129b..47edf53bb 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
@@ -123,6 +123,17 @@ public class TestGLProfile01NEWT extends UITestCase {
System.out.println("GLProfile GL2ES2: "+glp);
dumpVersion(glp);
}
+
+ @Test
+ public void testGLProfileGL4ES3() 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);
+ dumpVersion(glp);
+ }
void testSpecificProfile(String glps) throws InterruptedException {
if(GLProfile.isAvailable(glps)) {
@@ -168,6 +179,11 @@ public class TestGLProfile01NEWT extends UITestCase {
testSpecificProfile(GLProfile.GLES2);
}
+ @Test
+ public void testGLES3() throws InterruptedException {
+ testSpecificProfile(GLProfile.GLES3);
+ }
+
protected void dumpVersion(GLProfile glp) throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
GLWindow glWindow = GLWindow.create(caps);
@@ -175,6 +191,59 @@ public class TestGLProfile01NEWT extends UITestCase {
glWindow.setTitle("TestGLProfile01NEWT");
glWindow.addGLEventListener(new DumpGLInfo());
+ glWindow.addGLEventListener(new GLEventListener() {
+
+ public void init(GLAutoDrawable drawable) {
+ final GL gl = drawable.getGL();
+ final GLProfile glp = gl.getGLProfile();
+ System.err.println("GL impl. class "+gl.getClass().getName());
+ if( gl.isGL4() ) {
+ Assert.assertNotNull( gl.getGL4() );
+ System.err.println("GL Mapping "+glp+" -> GL4");
+ }
+ if( gl.isGL4bc() ) {
+ Assert.assertNotNull( gl.getGL4bc() );
+ System.err.println("GL Mapping "+glp+" -> GL4bc");
+ }
+ if( gl.isGL3() ) {
+ Assert.assertNotNull( gl.getGL3() );
+ System.err.println("GL Mapping "+glp+" -> GL3");
+ }
+ if( gl.isGL3bc() ) {
+ Assert.assertNotNull( gl.getGL3bc() );
+ System.err.println("GL Mapping "+glp+" -> GL3bc");
+ }
+ if( gl.isGLES3() ) {
+ Assert.assertNotNull( gl.getGLES3() );
+ System.err.println("GL Mapping "+glp+" -> GLES3");
+ }
+ if( gl.isGLES2() ) {
+ Assert.assertNotNull( gl.getGLES2() );
+ System.err.println("GL Mapping "+glp+" -> GLES2");
+ }
+ if( gl.isGL4ES3() ) {
+ Assert.assertNotNull( gl.getGL4ES3() );
+ System.err.println("GL Mapping "+glp+" -> GL4ES3");
+ }
+ if( gl.isGL2ES2() ) {
+ Assert.assertNotNull( gl.getGL2ES2() );
+ System.err.println("GL Mapping "+glp+" -> GL2ES2");
+ }
+ if( gl.isGL2ES1() ) {
+ Assert.assertNotNull( gl.getGL2ES1() );
+ 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) {
+ }
+ });
glWindow.setSize(128, 128);
glWindow.setVisible(true);