From 1a20ef3aa1dc9acedd7da0475ee19d4c40b18498 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 16 Jul 2013 20:46:42 +0200 Subject: Redefine: isGLES3Compatible() and isGL4ES3(), i.e. allow GL4ES3 usage in case proper ES3_compat is given. isGLES3Compatible() and isGL4ES3() of GLBase _and_ GLContext includes [ GL >= 4.3, GL >= 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]. Tested GL 'aliasing' w/ TestGLProfile01NEWT, i.e. isGL*() and getGL*(). --- src/jogl/classes/javax/media/opengl/GLContext.java | 45 ++++++++++++++++++---- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java') 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 GL_ARB_ES3_compatibility */ + 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 GL_ARB_ES3_compatibility, otherwise false + * Return true if this context is an ES3 context or implements + * the extension GL_ARB_ES3_compatibility, otherwise false. + *

+ * Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ] + *

*/ 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.

Includes [ GL4bc, GL4, GLES3 ].

- * @see GLProfile#isGL4ES3() + * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true. + *

Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]

+ * @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 ≥ 4.3 context or a ≥ 3.1 context supporting GL_ARB_ES3_compatibility, + * otherwise false. + *

+ * Includes [ GL4 > 4.3, GL3 > 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]. + *

+ */ + 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); } -- cgit v1.2.3