diff options
Diffstat (limited to 'src/jogl')
5 files changed, 36 insertions, 26 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 9a921091c..26abc53ba 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -266,7 +266,7 @@ public abstract class GLDrawableFactory { throw new InternalError("no default device"); } if (GLProfile.DEBUG) { - System.err.println("Info: GLDrawableFactory.validateDevice: using default device : "+device); + System.err.println("Info: "+getClass().getSimpleName()+".validateDevice: using default device : "+device); } } @@ -274,7 +274,7 @@ public abstract class GLDrawableFactory { // since even the default device may not be used by this factory. if( !getIsDeviceCompatible(device) ) { if (GLProfile.DEBUG) { - System.err.println("Info: GLDrawableFactory.validateDevice: device not compatible : "+device); + System.err.println("Info: "+getClass().getSimpleName()+".validateDevice: device not compatible : "+device); } return null; } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 83e8e0bbf..4d4b0d82c 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1519,10 +1519,10 @@ public class GLProfile { boolean addedDesktopProfile = false; boolean addedEGLProfile = false; - boolean deviceIsDesktopCompatible = false; - boolean deviceIsEGLCompatible = false; - if( hasDesktopGLFactory && ( deviceIsDesktopCompatible = desktopFactory.getIsDeviceCompatible(device)) ) { + final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device); + + if( deviceIsDesktopCompatible ) { // 1st pretend we have all Desktop and EGL profiles .. computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */); @@ -1536,22 +1536,21 @@ public class GLProfile { if(null != sharedResourceThread) { initLock.removeOwner(sharedResourceThread); } - if(!desktopSharedCtxAvail) { - hasDesktopGLFactory = false; - } if (DEBUG) { System.err.println("GLProfile.initProfilesForDevice: "+device+": desktop Shared Ctx "+desktopSharedCtxAvail); } - if( hasDesktopGLFactory && !GLContext.getAvailableGLVersionsSet(device) ) { + if(!desktopSharedCtxAvail) { + hasDesktopGLFactory = false; + } else if( !GLContext.getAvailableGLVersionsSet(device) ) { throw new InternalError("Available GLVersions not set"); } addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */); } + final boolean deviceIsEGLCompatible = hasEGLFactory && eglFactory.getIsDeviceCompatible(device); + // also test GLES1 and GLES2 on desktop, since we have implementations / emulations available - if( hasEGLFactory && ( hasGLES2Impl || hasGLES1Impl ) && - ( deviceIsEGLCompatible = eglFactory.getIsDeviceCompatible(device)) ) { - + if( deviceIsEGLCompatible && ( hasGLES2Impl || hasGLES1Impl ) ) { // 1st pretend we have all EGL profiles .. computeProfileMap(device, false /* desktopCtxUndef*/, true /* esCtxUndef */); diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index a33e03a1a..0528d3060 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -260,7 +260,9 @@ public class SharedResourceRunner implements Runnable { try { sr = impl.createSharedResource(initConnection); } catch (Exception e) { - e.printStackTrace(); + if(DEBUG) { + e.printStackTrace(); + } } if (null != sr) { impl.mapPut(initConnection, sr); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 33e85dd0b..8b90d6887 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -90,22 +90,29 @@ public class GLXUtil { } public static VersionNumber getClientVersionNumber() { return clientVersionNumber; - } - public static synchronized boolean initGLXClientDataSingleton(X11GraphicsDevice x11Device) { + } + + 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 false; - } - if(DEBUG) { - System.err.println("initGLXClientDataSingleton: "+x11Device); - Thread.dumpStack(); + return; // already initialized } if(null == x11Device) { - throw new GLException("null X11GraphicsDevice"); + throw new IllegalArgumentException("null X11GraphicsDevice"); } if(0 == x11Device.getHandle()) { - throw new GLException("null X11GraphicsDevice display handle"); - } - + throw new IllegalArgumentException("null X11GraphicsDevice display handle"); + } clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS)); clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR); @@ -121,7 +128,6 @@ public class GLXUtil { minor[0] = 2; } clientVersionNumber = new VersionNumber(major[0], minor[0], 0); - return true; } private static boolean clientMultisampleAvailable = false; private static String clientVendorName = null; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 4f333406f..2ba067b02 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -103,7 +103,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT); - if(null!=x11GLXDynamicLookupHelper) { + if(null!=x11GLXDynamicLookupHelper) { // Register our GraphicsConfigurationFactory implementations // The act of constructing them causes them to be registered X11GLXGraphicsConfigurationFactory.registerFactory(); @@ -220,6 +220,9 @@ 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); + } GLXUtil.initGLXClientDataSingleton(sharedDevice); final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR); final VersionNumber glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice.getHandle()); |