From c1c8dcbb0d51e4e2a902db129e5a6991d84c5fc9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 31 Jul 2011 19:25:13 +0200 Subject: JOGL: Add GLBase::isGLES2Compatible() Indicates whether this GL object is compatible with OpenGL ES2, i.e. has the extension GL_ARB_ES2_compatibility --- src/jogl/classes/javax/media/opengl/GLBase.java | 7 +++++++ src/jogl/classes/javax/media/opengl/GLContext.java | 20 +++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/javax/media/opengl') 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 @@ -153,6 +153,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 GL_ARB_ES2_compatibility, 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 { /** ARB_create_context related: flag not forward compatible */ protected static final int CTX_OPTION_ANY = 1 << 5; /** ARB_create_context related: flag debug */ - public static final int CTX_OPTION_DEBUG = 1 << 6; + public static final int CTX_OPTION_DEBUG = 1 << 6; + /** GL_ARB_ES2_compatibility 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 GL_ARB_ES2_compatibility, 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 )); -- cgit v1.2.3