diff options
author | Sven Gothel <[email protected]> | 2012-08-16 16:01:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-08-16 16:01:49 +0200 |
commit | ef099612d2adb7223d928d2ba7a88f984501ddb9 (patch) | |
tree | 4f80edeff5522ddd81644eeeca8b8454968a8884 /src/jogl/classes/jogamp | |
parent | 43a473b2005d7f59a7f4f5b8bc7ca9ae88b4e894 (diff) |
EGLGraphicsConfigurationFactory: Fix platform w/o GLX but X11 window handle.
Without GLX but X11 windows, there is no pre-configured X11GLXGraphicsConfigurationFactory set,
hence fetch the fallback X11GraphicsConfigurationFactory via:
GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class)
TODO: Cleanup cases for other platform - simplify!
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 0b21d2054..72dea9ead 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -74,6 +74,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static VisualIDHolder.VIDComparator EglCfgIDComparator = new VisualIDHolder.VIDComparator(VisualIDHolder.VIDType.EGL_CONFIG); static GraphicsConfigurationFactory nativeGraphicsConfigurationFactory = null; static GraphicsConfigurationFactory kdeglGraphicsConfigurationFactory = null; + static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; static void registerFactory() { GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); @@ -82,13 +83,18 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact final String nwType = NativeWindowFactory.getNativeWindowType(false); if(NativeWindowFactory.TYPE_X11 == nwType) { nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); + if(null != nativeGraphicsConfigurationFactory) { + fallbackGraphicsConfigurationFactory = nativeGraphicsConfigurationFactory; + } else { + fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class); + } } /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) { nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory); } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ // become the selector for KD/EGL .. - kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); + kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory); } static void unregisterFactory() { @@ -100,6 +106,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { } */ nativeGraphicsConfigurationFactory = null; + fallbackGraphicsConfigurationFactory = null; GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, kdeglGraphicsConfigurationFactory); kdeglGraphicsConfigurationFactory = null; @@ -143,8 +150,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact absScreen, nativeVisualID, false); } else { // handle non native cases (X11, ..) - if(null == nativeGraphicsConfigurationFactory) { - throw new InternalError("Native GraphicsConfigurationFactory is null, but call issued for device: "+absDevice+" of type "+absDevice.getClass().getSimpleName()); + if(null == fallbackGraphicsConfigurationFactory) { + throw new InternalError("Native fallback GraphicsConfigurationFactory is null, but call issued for device: "+absDevice+" of type "+absDevice.getClass().getSimpleName()); } if(glCapsChosen.getGLProfile().usesNativeGLES()) { @@ -165,9 +172,9 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null == cfg) { // fwd to native config factory (only X11 for now) if(DEBUG) { - System.err.println("EGLGraphicsConfigurationFactory.choose..: Delegate to "+nativeGraphicsConfigurationFactory.getClass().getSimpleName()); + System.err.println("EGLGraphicsConfigurationFactory.choose..: Delegate to "+fallbackGraphicsConfigurationFactory.getClass().getSimpleName()); } - cfg = nativeGraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, nativeVisualID); + cfg = fallbackGraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, nativeVisualID); } } return cfg; |