diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
3 files changed, 31 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index a33e03a1a..7e050c81e 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -46,6 +46,12 @@ public class SharedResourceRunner implements Runnable { public static interface Implementation { /** * @param connection for creation a {@link AbstractGraphicsDevice} instance. + * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>. + */ + boolean isDeviceSupported(String connection); + + /** + * @param connection for creation a {@link AbstractGraphicsDevice} instance. * @return A new shared resource instance */ Resource createSharedResource(String connection); @@ -157,8 +163,10 @@ public class SharedResourceRunner implements Runnable { if (DEBUG) { System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+Thread.currentThread().getName()); } - doAndWait(connection, null); - sr = impl.mapGet(connection); + if ( impl.isDeviceSupported(connection) ) { + doAndWait(connection, null); + sr = impl.mapGet(connection); + } if (DEBUG) { System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+Thread.currentThread().getName()); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index c6bc61a27..9c96f3e3c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -309,6 +309,11 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override + public boolean isDeviceSupported(String connection) { + return true; + } + + @Override public SharedResourceRunner.Resource createSharedResource(String connection) { final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT); sharedDevice.lock(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index e38aabef8..8d1717e75 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -228,6 +228,22 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override + public boolean isDeviceSupported(String connection) { + final boolean res; + final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); + x11Device.lock(); + try { + res = GLXUtil.isGLXAvailableOnServer(x11Device); + } finally { + x11Device.unlock(); + } + if(DEBUG) { + System.err.println("GLX "+(res ? "is" : "not")+" available on device/server: "+x11Device); + } + return res; + } + + @Override public SharedResourceRunner.Resource createSharedResource(String connection) { final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); sharedDevice.lock(); |