aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-desktop.java4
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles1.java4
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles2.java4
-rw-r--r--make/config/jogl/gl2_es2-common.cfg10
-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
8 files changed, 45 insertions, 16 deletions
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
index 4edb28272..34013209f 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
@@ -32,6 +32,10 @@
return _context.isGL2ES2();
}
+ public final boolean isGLES2Compatible() {
+ return _context.isGLES2Compatible();
+ }
+
public final boolean isGL2GL3() {
return _context.isGL2GL3();
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
index 98ec4e550..8b6d1dadc 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
@@ -46,6 +46,10 @@ public final boolean isGL2ES2() {
return false;
}
+public final boolean isGLES2Compatible() {
+ return false;
+}
+
public final boolean isGL2GL3() {
return false;
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
index 760ec375e..b009d935b 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
@@ -50,6 +50,10 @@ public final boolean isGL2ES2() {
return true;
}
+public final boolean isGLES2Compatible() {
+ return true;
+}
+
public final boolean isGL2GL3() {
return false;
}
diff --git a/make/config/jogl/gl2_es2-common.cfg b/make/config/jogl/gl2_es2-common.cfg
index 89f30a941..d26c76ead 100644
--- a/make/config/jogl/gl2_es2-common.cfg
+++ b/make/config/jogl/gl2_es2-common.cfg
@@ -1,22 +1,22 @@
-JavaPrologue glReleaseShaderCompiler if ( !_context.hasNativeES2Methods() ) {
+JavaPrologue glReleaseShaderCompiler if ( !_context.isGLES2Compatible() ) {
JavaPrologue glReleaseShaderCompiler return;
JavaPrologue glReleaseShaderCompiler }
-JavaPrologue glShaderBinary if ( !_context.hasNativeES2Methods() ) {
+JavaPrologue glShaderBinary if ( !_context.isGLES2Compatible() ) {
JavaPrologue glShaderBinary throw new GLException("Method \"glShaderBinary\" not available");
JavaPrologue glShaderBinary }
-JavaPrologue glGetShaderPrecisionFormat if ( !_context.hasNativeES2Methods() ) {
+JavaPrologue glGetShaderPrecisionFormat if ( !_context.isGLES2Compatible() ) {
JavaPrologue glGetShaderPrecisionFormat throw new GLException("Method \"glGetShaderPrecisionFormat\" not available");
JavaPrologue glGetShaderPrecisionFormat }
-JavaPrologue glDepthRangef if ( !_context.hasNativeES2Methods() ) {
+JavaPrologue glDepthRangef if ( !_context.isGLES2Compatible() ) {
JavaPrologue glDepthRangef glDepthRange( (double)zNear, (double)zFar );
JavaPrologue glDepthRangef return;
JavaPrologue glDepthRangef }
-JavaPrologue glClearDepthf if ( !_context.hasNativeES2Methods() ) {
+JavaPrologue glClearDepthf if ( !_context.isGLES2Compatible() ) {
JavaPrologue glClearDepthf glClearDepth( (double)depth );
JavaPrologue glClearDepthf return;
JavaPrologue glClearDepthf }
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