diff options
3 files changed, 26 insertions, 19 deletions
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; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index ebe202f31..217d88f3c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -296,12 +296,13 @@ public class WindowsWGLContext extends GLContextImpl { throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: "+GDI.GetLastError()); } setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION - boolean isCreateContextAttribsARBAvailable = isFunctionAvailable("wglCreateContextAttribsARB"); WGL.wglMakeCurrent(0, 0); // release temp context if( !createContextARBTried) { - if(isCreateContextAttribsARBAvailable && - isExtensionAvailable("WGL_ARB_create_context") ) { + // is*Available calls are valid since setGLFunctionAvailability(..) was called + final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("wglCreateContextAttribsARB"); + final boolean isExtARBCreateContextAvailable = isExtensionAvailable("WGL_ARB_create_context"); + if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) { // initial ARB context creation contextHandle = createContextARB(share, true); createContextARBTried=true; @@ -313,7 +314,8 @@ public class WindowsWGLContext extends GLContextImpl { } } } else if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share); + System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+ + ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 12bb2a9a6..08e064da5 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -335,12 +335,13 @@ public abstract class X11GLXContext extends GLContextImpl { throw new GLException("Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable); } setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION - boolean isCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB"); glXMakeContextCurrent(display, 0, 0, 0); // release temp context if( !createContextARBTried ) { - if ( isCreateContextAttribsARBAvailable && - isExtensionAvailable("GLX_ARB_create_context") ) { + // is*Available calls are valid since setGLFunctionAvailability(..) was called + final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB"); + final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context"); + if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) { // initial ARB context creation contextHandle = createContextARB(share, direct); createContextARBTried=true; @@ -352,7 +353,8 @@ public abstract class X11GLXContext extends GLContextImpl { } } } else if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share); + System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+ + ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } } } |