aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java25
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java18
3 files changed, 29 insertions, 18 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
index 8b90d6887..7d03bbb88 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
@@ -43,6 +43,20 @@ import com.jogamp.common.util.VersionNumber;
public class GLXUtil {
public static final boolean DEBUG = Debug.debug("GLXUtil");
+ public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) {
+ if(null == x11Device) {
+ throw new IllegalArgumentException("null X11GraphicsDevice");
+ }
+ if(0 == x11Device.getHandle()) {
+ throw new IllegalArgumentException("null X11GraphicsDevice display handle");
+ }
+ boolean glXAvailable = false;
+ try {
+ glXAvailable = GLX.glXQueryExtension(x11Device.getHandle(), null, 0, null, 0);
+ } catch (Throwable t) { /* n/a */ }
+ return glXAvailable;
+ }
+
public static VersionNumber getGLXServerVersionNumber(long display) {
int[] major = new int[1];
int[] minor = new int[1];
@@ -92,17 +106,6 @@ public class GLXUtil {
return clientVersionNumber;
}
- public static synchronized boolean isGLXAvailable(long handle) {
- if(0 == handle) {
- throw new IllegalArgumentException("null X11 display handle");
- }
- boolean glXAvailable = false;
- try {
- glXAvailable = GLX.glXQueryExtension(handle, null, 0, null, 0);
- } catch (Throwable t) { /* n/a */ }
- return glXAvailable;
- }
-
public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) {
if(null != clientVendorName) {
return; // already initialized
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 2ba067b02..55d0e9400 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -220,8 +220,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
// NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking
sharedDevice.lock();
try {
- if(!GLXUtil.isGLXAvailable(sharedDevice.getHandle())) {
- throw new GLException("GLX not available on device: "+sharedDevice);
+ if(!GLXUtil.isGLXAvailableOnServer(sharedDevice)) {
+ throw new GLException("GLX not available on device/server: "+sharedDevice);
}
GLXUtil.initGLXClientDataSingleton(sharedDevice);
final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 344c56f64..e77cba9d0 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -52,7 +52,6 @@ import javax.media.opengl.GLProfile;
import com.jogamp.common.nio.PointerBuffer;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.XVisualInfo;
-import jogamp.opengl.Debug;
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
@@ -67,11 +66,10 @@ import java.util.List;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
- protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
static X11GLCapabilities.XVisualIDComparator XVisualIDComparator = new X11GLCapabilities.XVisualIDComparator();
-
+ static GraphicsConfigurationFactory fallbackX11GraphicsConfigurationFactory = null;
static void registerFactory() {
- GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, new X11GLXGraphicsConfigurationFactory());
+ fallbackX11GraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, new X11GLXGraphicsConfigurationFactory());
}
private X11GLXGraphicsConfigurationFactory() {
}
@@ -93,6 +91,16 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
+
+ if(!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice)absScreen.getDevice())) {
+ if(null != fallbackX11GraphicsConfigurationFactory) {
+ if(DEBUG) {
+ System.err.println("No GLX available, fallback to "+fallbackX11GraphicsConfigurationFactory.getClass().getSimpleName()+" for: "+absScreen);
+ }
+ return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen);
+ }
+ throw new InternalError("No GLX and no fallback GraphicsConfigurationFactory available for: "+absScreen);
+ }
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested,
(GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen);
}
@@ -187,7 +195,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (capsChosen == null) {
capsChosen = new GLCapabilities(null);
}
- X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
+ X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory.canCreateGLPbuffer(x11Device) );