From 7a40768455342ab2d1d43bf435baa42a8ccaf917 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 18 Mar 2012 22:33:46 +0100 Subject: Fix bug 564 (X11 Mesa 8.0.1 GL 3.0 w/o GLX_ARB_create_context) X11/Mesa 8.0.1 offers a GL 3.0 context w/o having the GLX_ARB_create_context extension available (even though the func-ptr glXCreateContextAttribsARB is not null). We assumed that if no GLContext device availability is set, it can be only GL 2.0 or ES1/ES2. Fix: Relaxed these (false) constrains and map the created context reflecting using it's actual attributes. --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 49b90008b..af8282752 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -542,12 +542,16 @@ public abstract class GLContextImpl extends GLContext { reqMajor = ctxMajorVersion; reqProfile = GLContext.CTX_PROFILE_ES; } else { - // Only GL2 actually - if(ctxMajorVersion>2 || 0 != ( ctxOptions & GLContext.CTX_PROFILE_CORE)) { - throw new InternalError("XXX: "+getGLVersion()); + if(ctxMajorVersion<3 || ctxMajorVersion==3 && ctxMinorVersion==0) { + reqMajor = 2; + } else { + reqMajor = ctxMajorVersion; + } + if( 0 != ( ctxOptions & GLContext.CTX_PROFILE_CORE) ) { + reqProfile = GLContext.CTX_PROFILE_CORE; + } else { + reqProfile = GLContext.CTX_PROFILE_COMPAT; } - reqMajor = 2; - reqProfile = GLContext.CTX_PROFILE_COMPAT; } GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxMajorVersion, ctxMinorVersion, ctxOptions); @@ -1137,18 +1141,17 @@ public abstract class GLContextImpl extends GLContext { public final boolean isFunctionAvailable(String glFunctionName) { // Check GL 1st (cached) - ProcAddressTable pTable = getGLProcAddressTable(); // null if ctx not created once - if(null!=pTable) { + if(null!=glProcAddressTable) { // null if this context wasn't not created try { - if(0!=pTable.getAddressFor(glFunctionName)) { + if(0!=glProcAddressTable.getAddressFor(glFunctionName)) { return true; } } catch (Exception e) {} } - // Check platform extensions 2nd (cached) - had to be enabled once - pTable = getPlatformExtProcAddressTable(); // null if ctx not created once - if(null!=pTable) { + // Check platform extensions 2nd (cached) - context had to be enabled once + final ProcAddressTable pTable = getPlatformExtProcAddressTable(); + if(null!=pTable) { try { if(0!=pTable.getAddressFor(glFunctionName)) { return true; -- cgit v1.2.3