aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2011-04-12 08:57:06 -0500
committerWade Walker <[email protected]>2011-04-12 08:57:06 -0500
commitf50f40e0fb2789537ecc19f8eaff439b24294a65 (patch)
tree4b94fcd392574b0ecf00952e31ae1c72f535430c /src/jogl/classes/jogamp/opengl
parenta140ed4798896ed5d786fbe63e7241309a4b4a91 (diff)
Fix problem with external context on CentOS 5.5 inside VMWare
This fixes a problem that's analogous to one we've had on Windows; apparently querying OS-specific info like hardware device contexts or framebuffer configuration IDs from external GL contexts doesn't always work properly, especially on 32-bit OSes and from within virtual machines.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java16
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);