From 6dd02dc6e2a84598e59639433d9199e47c5c19ae Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 24 Jul 2007 22:41:45 +0000 Subject: Added workaround for running in headless mode while still retaining pbuffer support and incorporated suggestion from Justin Couch for working around Mesa pbuffer bug where GLX_STEREO specification (even to "false") would cause glXChooseFBConfig to fail git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1312 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../sun/opengl/impl/x11/X11GLDrawableFactory.java | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/classes/com') diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java index 594fb0f7f..6ff112348 100644 --- a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java @@ -59,6 +59,9 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { // in this case private static boolean isVendorATI; + // See whether we're running in headless mode + private static boolean isHeadless; + // Map for rediscovering the GLCapabilities associated with a // particular screen and visualID after the fact private static Map visualToGLCapsMap = Collections.synchronizedMap(new HashMap()); @@ -98,6 +101,8 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { com.sun.opengl.impl.NativeLibLoader.loadCore(); DRIHack.end(); + + isHeadless = GraphicsEnvironment.isHeadless(); } public X11GLDrawableFactory() { @@ -415,12 +420,10 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { if (pbuffer) { res[idx++] = GL.GL_TRUE; } - } else { - if (pbuffer) { - res[idx++] = GLX.GLX_STEREO; - res[idx++] = GL.GL_FALSE; - } } + // NOTE: don't set (GLX_STEREO, GL_FALSE) in "else" branch for + // pbuffer case to work around Mesa bug + res[idx++] = GLX.GLX_RED_SIZE; res[idx++] = caps.getRedBits(); res[idx++] = GLX.GLX_GREEN_SIZE; @@ -547,12 +550,26 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { } public void lockToolkit() { + if (isHeadless) { + // Workaround for running (to some degree) in headless + // environments but still supporting rendering via pbuffers + // For full correctness, would need to implement a Lock class + return; + } + if (!Java2D.isOGLPipelineActive() || !Java2D.isQueueFlusherThread()) { JAWT.getJAWT().Lock(); } } public void unlockToolkit() { + if (isHeadless) { + // Workaround for running (to some degree) in headless + // environments but still supporting rendering via pbuffers + // For full correctness, would need to implement a Lock class + return; + } + if (!Java2D.isOGLPipelineActive() || !Java2D.isQueueFlusherThread()) { JAWT.getJAWT().Unlock(); } -- cgit v1.2.3