summaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-07-24 22:41:45 +0000
committerKenneth Russel <[email protected]>2007-07-24 22:41:45 +0000
commit6dd02dc6e2a84598e59639433d9199e47c5c19ae (patch)
treeda578b18a9035e0b2af470bd981c8a8abf93b47d /src/classes
parent4eaa7de63898235dd5e30a495556272f10a7c620 (diff)
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
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java27
1 files changed, 22 insertions, 5 deletions
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();
}