diff options
author | Sven Gothel <[email protected]> | 2013-05-06 17:31:31 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-06 17:31:31 +0200 |
commit | c8f41307f4a622398b3e765badc0525d74c2cbf7 (patch) | |
tree | eef41602fdd774ba92be0c45c82a5891b2835b32 /src/jogl/classes/jogamp/opengl/x11 | |
parent | 502e1d863e636808b7436354c3b639fc2f92bf29 (diff) |
Fix GLX: X11GLXContext used wrong FBConfig n/a query; X11GLX*: If FBConfig is n/a force GLX (server) version down to 1.1 to avoid crashes w/ old GLX server (i.e. Mesa 4.*).
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
3 files changed, 22 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 0d56bcde1..c37bcee50 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -146,6 +146,13 @@ public class X11GLXContext extends GLContextImpl { isGLXVersionGreaterEqualOneThree = null != glXServerVersion ? glXServerVersion.compareTo(X11GLXDrawableFactory.versionOneThree) >= 0 : false; return isGLXVersionGreaterEqualOneThree; } + protected final void forceGLXVersionOneOne() { + glXServerVersion = X11GLXDrawableFactory.versionOneOne; + isGLXVersionGreaterEqualOneThree = false; + if(DEBUG) { + System.err.println("X11GLXContext.forceGLXVersionNumber: "+glXServerVersion); + } + } @Override public final boolean isGLReadDrawableAvailable() { @@ -300,8 +307,9 @@ public class X11GLXContext extends GLContextImpl { final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = glCaps.getGLProfile(); - if( config.getFBConfigID() < 0 ) { - // not able to use FBConfig + if( !config.hasFBConfig() ) { + // not able to use FBConfig -> GLX 1.1 + forceGLXVersionOneOne(); if(glp.isGL3()) { throw new GLException(getThreadName()+": Unable to create OpenGL >= 3.1 context"); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index e44be7509..394293bc0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -262,7 +262,6 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { GLXUtil.initGLXClientDataSingleton(sharedDevice); final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR); - final VersionNumber glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice); final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS)); final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); @@ -273,7 +272,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final GLCapabilitiesImmutable caps = new GLCapabilities(glp); final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64)); sharedDrawable.setRealized(true); - + final X11GLCapabilities chosenCaps = (X11GLCapabilities) sharedDrawable.getChosenGLCapabilities(); + final boolean glxForcedOneOne = !chosenCaps.hasFBConfig(); + final VersionNumber glXServerVersion; + if( glxForcedOneOne ) { + glXServerVersion = versionOneOne; + } else { + glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice); + } final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null); if (null == sharedContext) { throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable); @@ -294,7 +300,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { System.err.println("SharedScreen: " + sharedScreen); System.err.println("SharedContext: " + sharedContext + ", madeCurrent " + madeCurrent); System.err.println("GLX Server Vendor: " + glXServerVendorName); - System.err.println("GLX Server Version: " + glXServerVersion); + System.err.println("GLX Server Version: " + glXServerVersion + ", forced "+glxForcedOneOne); System.err.println("GLX Server Multisample: " + glXServerMultisampleAvailable); System.err.println("GLX Client Vendor: " + GLXUtil.getClientVendorName()); System.err.println("GLX Client Version: " + GLXUtil.getClientVersionNumber()); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index 523364389..c23bd5337 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -79,6 +79,9 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem public final int getFBConfigID() { return ((X11GLCapabilities)capabilitiesChosen).getFBConfigID(); } + public final boolean hasFBConfig() { + return ((X11GLCapabilities)capabilitiesChosen).hasFBConfig(); + } void updateGraphicsConfiguration() { final CapabilitiesImmutable aChosenCaps = getChosenCapabilities(); |