summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-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
4 files changed, 101 insertions, 48 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 ) ) {