aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-01-15 05:46:40 +0100
committerSven Gothel <[email protected]>2023-01-15 05:46:40 +0100
commitedf0d33ba913fd37f9e6ce0a771d8dfb6fa962e6 (patch)
treea61a80cef9a39768d0683a04c7ae32c17725036d
parentf10f0658a8e6e91684ab07573fafe20dd87219d3 (diff)
Fix GLProfile GL2 Mapping: Only use GL3bc is available, add additional GLContext.isGL3bcAvailable() check
Julien Gouesse resolved this odd issue, where a requested GL2 profile was mapped to GL3bc but is not implemented, see <https://forum.jogamp.org/InternalError-XXX0-profile-2-GL2-gt-profileImpl-GL3bc-not-mapped-td4041754i20.html#a4042018>. I exploded his patch a little to reuse the GLContext.getAvailableGLProfileName() result and simplify the conditional statement. This might need more testing perhaps, plus analyis why GLContext.getAvailableGLProfileName() offers GL3bc but is not available via GLContext.isGL3bcAvailable() check.
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLProfile.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLProfile.java b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
index 27480cb53..d86c15772 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLProfile.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
@@ -2293,7 +2293,17 @@ public class GLProfile {
} else if(GL3 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL3Available(device, isHardwareRasterizer))) {
return desktopCtxUndef ? GL3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_CORE);
} else if(GL2 == profile && hasAnyGL234Impl && ( desktopCtxUndef || GLContext.isGL2Available(device, isHardwareRasterizer))) {
- return desktopCtxUndef ? GL2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT);
+ // return desktopCtxUndef ? GL2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT);
+ if( desktopCtxUndef ) {
+ return GL2;
+ } else {
+ final String gl2_impl = GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT);
+ if( GL3bc == gl2_impl && !GLContext.isGL3bcAvailable(device, isHardwareRasterizer) ) {
+ return GL2;
+ } else {
+ return gl2_impl;
+ }
+ }
} else if(GLES3 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, isHardwareRasterizer))) {
return esCtxUndef ? GLES3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_ES);
} else if(GLES2 == profile && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES2Available(device, isHardwareRasterizer))) {