diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx')
-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); |