diff options
author | Sven Gothel <[email protected]> | 2013-10-25 01:29:24 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-25 01:29:24 +0200 |
commit | e1ffbf2ae6eb837dc1576eedaacbbb68247139f2 (patch) | |
tree | e00b24a4317943e668bb831232499b0ac749bc1b | |
parent | f8b21903cf0db85fdc16c8e1892003702a05a33f (diff) |
Fix GLContext: getGLProfile() add missing GLES3; getAvailableGLProfile(device, ..) shall use GLProfile.get(device, ..)
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 19 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 0ce0353d6..55050f25c 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -1668,7 +1668,8 @@ public abstract class GLContext { if(major >= 4) { return GLProfile.GL4; } else if(major == 3 && minor >= 1) { return GLProfile.GL3; } } else if(0 != ( CTX_PROFILE_ES & ctp )) { - if(major == 2) { return GLProfile.GLES2; } + if(major == 3) { return GLProfile.GLES3; } + else if(major == 2) { return GLProfile.GLES2; } else if(major == 1) { return GLProfile.GLES1; } } throw new GLException("Unhandled OpenGL version/profile: "+GLContext.getGLVersion(major, minor, ctp, null)); @@ -1719,15 +1720,27 @@ public abstract class GLContext { * @param device the device the profile is being requested * @param major Key Value either 1, 2, 3 or 4 * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} - * @return the highest GLProfile regarding availability, version and profile bits. + * @return the highest GLProfile for the device regarding availability, version and profile bits. */ protected static GLProfile getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile) throws GLException { + final String glpName = getAvailableGLProfileName(device, reqMajor, reqProfile); + return null != glpName ? GLProfile.get(device, glpName) : null; + } + + /** + * @param device the device the profile is being requested + * @param major Key Value either 1, 2, 3 or 4 + * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} + * @return the highest GLProfile name for the device regarding availability, version and profile bits. + */ + /* package */ static String getAvailableGLProfileName(AbstractGraphicsDevice device, int reqMajor, int reqProfile) + throws GLException { int major[] = { 0 }; int minor[] = { 0 }; int ctp[] = { 0 }; if(GLContext.getAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp)) { - return GLProfile.get(GLContext.getGLProfile(major[0], minor[0], ctp[0])); + return GLContext.getGLProfile(major[0], minor[0], ctp[0]); } return null; } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 241d5a217..8542a799a 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -826,7 +826,7 @@ public abstract class GLContextImpl extends GLContext { final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int[] reqMajorCTP = new int[] { 0, 0 }; - getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP); + GLContext.getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP); if(DEBUG) { System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null)); |