summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-31 19:25:13 +0200
committerSven Gothel <[email protected]>2011-07-31 19:25:13 +0200
commitc1c8dcbb0d51e4e2a902db129e5a6991d84c5fc9 (patch)
treefe6e090ba13d84b276b4141d8d75965d06af26e4 /src/jogl/classes
parenta7bd295f0fd5740833a0c2fb55c474d995f65819 (diff)
JOGL: Add GLBase::isGLES2Compatible()
Indicates whether this GL object is compatible with OpenGL ES2, i.e. has the extension <code>GL_ARB_ES2_compatibility</code>
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java3
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java7
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java9
4 files changed, 28 insertions, 11 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index 11919f9fd..f3d0d37b1 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -630,6 +630,9 @@ public class BuildComposablePipeline {
output.println(" public boolean isGLES() {");
output.println(" return isGLES2() || isGLES1();");
output.println(" }");
+ output.println(" public boolean isGLES2Compatible() {");
+ output.println(" return " + getDownstreamObjectName() + ".isGLES2Compatible();");
+ output.println(" }");
}
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index 90b320ed3..f93d443e0 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -154,6 +154,13 @@ public interface GLBase {
public boolean isGL2ES2();
/**
+ * Indicates whether this GL object is compatible with OpenGL ES2.
+ * @return true if this context is an ES2 context or implements
+ * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
+ */
+ public boolean isGLES2Compatible();
+
+ /**
* Indicates whether this GL object conforms to the GL2GL3 compatible profile.
* @return whether this GL object conforms to the GL2GL3 profile
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 30cc9c2ea..766533aab 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -88,7 +88,9 @@ public abstract class GLContext {
/** <code>ARB_create_context</code> related: flag not forward compatible */
protected static final int CTX_OPTION_ANY = 1 << 5;
/** <code>ARB_create_context</code> related: flag debug */
- public static final int CTX_OPTION_DEBUG = 1 << 6;
+ public static final int CTX_OPTION_DEBUG = 1 << 6;
+ /** <code>GL_ARB_ES2_compatibility</code> related: Context is compatible w/ ES2 */
+ protected static final int CTX_PROFILE_ES2_COMPAT = 1 << 8;
/** GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL software implementation */
protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 0;
@@ -416,7 +418,6 @@ public abstract class GLContext {
public final int getGLVersionMinor() { return ctxMinorVersion; }
public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); }
public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); }
- public final boolean isGLEmbeddedProfile() { return ( 0 != ( CTX_PROFILE_ES & ctxOptions ) ); }
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
@@ -508,15 +509,15 @@ public abstract class GLContext {
}
public final boolean isGLES1() {
- return ctxMajorVersion==1 && 0!=(ctxOptions & CTX_PROFILE_ES);
+ return ctxMajorVersion==1 && 0 != ( ctxOptions & CTX_PROFILE_ES ) ;
}
public final boolean isGLES2() {
- return ctxMajorVersion==2 && 0!=(ctxOptions & CTX_PROFILE_ES);
+ return ctxMajorVersion==2 && 0 != ( ctxOptions & CTX_PROFILE_ES ) ;
}
public final boolean isGLES() {
- return isGLEmbeddedProfile();
+ return 0 != ( CTX_PROFILE_ES & ctxOptions ) ;
}
public final boolean isGL2ES1() {
@@ -527,6 +528,14 @@ public abstract class GLContext {
return isGL2GL3() || isGLES2() ;
}
+ /**
+ * @return true if this context is an ES2 context or implements
+ * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
+ */
+ public final boolean isGLES2Compatible() {
+ return 0 != ( ctxOptions & CTX_PROFILE_ES2_COMPAT ) ;
+ }
+
public final boolean hasGLSL() {
return isGL2ES2() ;
}
@@ -861,6 +870,7 @@ public abstract class GLContext {
sb.append(minor);
sb.append(" (");
needColon = appendString(sb, "ES", needColon, 0 != ( CTX_PROFILE_ES & ctp ));
+ needColon = appendString(sb, "ES2 compatible", needColon, 0 != ( CTX_PROFILE_ES2_COMPAT & ctp ));
needColon = appendString(sb, "compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp ));
needColon = appendString(sb, "core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp ));
needColon = appendString(sb, "forward compatible", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 1d5c6911b..aef90dbe6 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -646,6 +646,9 @@ public abstract class GLContextImpl extends GLContext {
}
if(0!=_context) {
AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+ if( isExtensionAvailable("GL_ARB_ES2_compatibility") ) {
+ ctp |= CTX_PROFILE_ES2_COMPAT;
+ }
GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, major[0], minor[0], ctp);
setGLFunctionAvailability(true, major[0], minor[0], ctp);
destroyContextARBImpl(_context);
@@ -931,8 +934,6 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
- hasNativeES2Methods = isGLES2() || isExtensionAvailable("GL_ARB_ES2_compatibility") ;
}
/**
@@ -940,10 +941,6 @@ public abstract class GLContextImpl extends GLContext {
*/
protected abstract void updateGLXProcAddressTable();
- protected boolean hasNativeES2Methods = false;
-
- public final boolean hasNativeES2Methods() { return hasNativeES2Methods; }
-
/**
* Returns true if the specified OpenGL core- or extension-function can be
* successfully called using this GL context given the current host (OpenGL