diff options
author | Sven Gothel <[email protected]> | 2011-04-27 15:43:28 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-27 15:43:28 -0700 |
commit | 371e42bbdef18a492587bbf07b02e72372362f75 (patch) | |
tree | 004d9dcc20e7c8dc51e884625da8652f33cfcb93 /src/jogl/classes/jogamp/opengl | |
parent | 50f0e0cd916324779ded008089dbc1b95193295a (diff) | |
parent | f50f40e0fb2789537ecc19f8eaff439b24294a65 (diff) |
Merged pull request #35 from WadeWalker/2011-04-12-fix-bug-493.
Fix problem with external context on CentOS 5.5 inside VMWare
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index c488fe5cf..39032117c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -75,7 +75,21 @@ public class X11ExternalGLXContext extends X11GLXContext { X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val[0]); GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val, 0); - X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); + X11GLXGraphicsConfiguration cfg = null; + // sometimes glXQueryContext on an external context gives us a framebuffer config ID + // of 0, which doesn't work in a subsequent call to glXChooseFBConfig; if this happens, + // create and use a default config (this has been observed when running on CentOS 5.5 inside + // of VMWare Server 2.0 with the Mesa 6.5.1 drivers) + if( 0 == X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, x11Screen.getIndex(), val[0]) ) { + GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); + cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen); + if(DEBUG) { + System.err.println("X11ExternalGLXContext invalid FBCONFIG_ID "+val[0]+", using default cfg: " + cfg); + } + } + else { + cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val[0]); + } WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(drawable); |