summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-06 10:01:02 +0100
committerSven Gothel <[email protected]>2015-03-06 10:01:02 +0100
commiteced1d4e45772a862d649e3cd7b500c6bc1643a1 (patch)
treea226e0549ffce207dd7625597c2d969405a4c68d /src/jogl/classes/com/jogamp/opengl
parent807c86913b465ce6071bc1af7ba6f8620cd5e772 (diff)
Bug 1135 - GL/GLContext: Add isGLES31Compatible()
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLBase.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLContext.java47
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLExtensions.java1
3 files changed, 56 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLBase.java b/src/jogl/classes/com/jogamp/opengl/GLBase.java
index b6704e6ba..dee5f1488 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLBase.java
@@ -224,6 +224,19 @@ public interface GLBase {
public boolean isGLES3Compatible();
/**
+ * Indicates whether this GL object is compatible with the core OpenGL ES3.1 functionality.
+ * <p>
+ * Return true if the underlying context is an ES3 context &ge; 3.1 or implements
+ * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false.
+ * </p>
+ * <p>
+ * Includes [ GL &ge; 4.5, GL &ge; 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 &ge; 3.1 ]
+ * </p>
+ * @see GLContext#isGLES31Compatible()
+ */
+ public boolean isGLES31Compatible();
+
+ /**
* Indicates whether this GL object supports GLSL.
* @see GLContext#hasGLSL()
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java
index 6366c4e37..5ecd5e1e1 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java
@@ -193,10 +193,13 @@ public abstract class GLContext {
//
/** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
- protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10;
+ protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10;
/** <code>GL_ARB_ES3_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
- protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11;
+ protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11;
+
+ /** <code>GL_ARB_ES3_1_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES31Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
+ protected static final int CTX_IMPL_ES31_COMPAT = 1 << 12;
/**
* Context supports basic FBO, details see {@link #hasBasicFBOSupport()}.
@@ -204,7 +207,7 @@ public abstract class GLContext {
* @see #hasBasicFBOSupport()
* @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)
*/
- protected static final int CTX_IMPL_FBO = 1 << 12;
+ protected static final int CTX_IMPL_FBO = 1 << 13;
/**
* Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points,
@@ -213,7 +216,7 @@ public abstract class GLContext {
* @see #hasFP32CompatAPI()
* @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)
*/
- protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 13;
+ protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 14;
private static final ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>();
@@ -911,6 +914,17 @@ public abstract class GLContext {
}
/**
+ * Return true if this context is an ES3 context &ge; 3.1 or implements
+ * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false.
+ * <p>
+ * Includes [ GL &ge; 4.5, GL &ge; 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 &ge; 3.1 ]
+ * </p>
+ */
+ public final boolean isGLES31Compatible() {
+ return 0 != ( ctxOptions & CTX_IMPL_ES31_COMPAT ) ;
+ }
+
+ /**
* @return true if impl. is a hardware rasterizer, otherwise false.
* @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile)
* @see GLProfile#isHardwareRasterizer()
@@ -988,7 +1002,7 @@ public abstract class GLContext {
final GL gl = getGL();
final int[] val = new int[] { 0 } ;
try {
- gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0);
+ gl.glGetIntegerv(GL.GL_MAX_SAMPLES, val, 0);
final int glerr = gl.glGetError();
if(GL.GL_NO_ERROR == glerr) {
return val[0];
@@ -1958,6 +1972,29 @@ public abstract class GLContext {
}
return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT );
}
+ /**
+ * Returns true if a ES3 &ge; 3.1 compatible profile is available,
+ * i.e. either a &ge; 4.5 context or a &ge; 3.1 context supporting <code>GL_ARB_ES3_1_compatibility</code>,
+ * otherwise false.
+ * <p>
+ * Includes [ GL &ge; 4.5, GL &ge; 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 &ge; 3.1 ]
+ * </p>
+ */
+ public static final boolean isGLES31CompatibleAvailable(final AbstractGraphicsDevice device) {
+ final int major[] = { 0 };
+ final int minor[] = { 0 };
+ final int ctp[] = { 0 };
+ boolean ok;
+
+ ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp);
+ if( !ok ) {
+ ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp);
+ }
+ if( !ok ) {
+ GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_COMPAT, major, minor, ctp);
+ }
+ return 0 != ( ctp[0] & CTX_IMPL_ES31_COMPAT );
+ }
public static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) {
return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware);
diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
index 1593da25c..1bf8071ea 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
@@ -52,6 +52,7 @@ public class GLExtensions {
public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility";
public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility";
+ public static final String ARB_ES3_1_compatibility = "GL_ARB_ES3_1_compatibility";
public static final String EXT_abgr = "GL_EXT_abgr";
public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8";