From edf0d33ba913fd37f9e6ce0a771d8dfb6fa962e6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 15 Jan 2023 05:46:40 +0100 Subject: 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 . 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. --- src/jogl/classes/com/jogamp/opengl/GLProfile.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/com/jogamp/opengl/GLProfile.java') 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))) { -- cgit v1.2.3