diff options
Diffstat (limited to 'src/nativewindow/classes/javax/media')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index e510c0b78..3f8746e2a 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -65,7 +65,27 @@ public abstract class GraphicsConfigurationFactory { private static Class<?> abstractGraphicsDeviceClass; static { - initialize(); + abstractGraphicsDeviceClass = javax.media.nativewindow.AbstractGraphicsDevice.class; + + // Register the default no-op factory for arbitrary + // AbstractGraphicsDevice implementations, including + // AWTGraphicsDevice instances -- the OpenGL binding will take + // care of handling AWTGraphicsDevices on X11 platforms (as + // well as X11GraphicsDevices in non-AWT situations) + registerFactory(abstractGraphicsDeviceClass, new DefaultGraphicsConfigurationFactoryImpl()); + + if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) { + try { + ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory", + "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + try { + ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory", + "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); + } catch (Exception e) { /* n/a */ } + } } protected static String getThreadName() { @@ -85,27 +105,6 @@ public abstract class GraphicsConfigurationFactory { protected GraphicsConfigurationFactory() { } - private static void initialize() { - abstractGraphicsDeviceClass = javax.media.nativewindow.AbstractGraphicsDevice.class; - - if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) { - try { - GraphicsConfigurationFactory factory = (GraphicsConfigurationFactory) - ReflectionUtil.createInstance("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory", null, - GraphicsConfigurationFactory.class.getClassLoader()); - registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, factory); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - // Register the default no-op factory for arbitrary - // AbstractGraphicsDevice implementations, including - // AWTGraphicsDevice instances -- the OpenGL binding will take - // care of handling AWTGraphicsDevices on X11 platforms (as - // well as X11GraphicsDevices in non-AWT situations) - registerFactory(abstractGraphicsDeviceClass, new DefaultGraphicsConfigurationFactoryImpl()); - } - /** Returns the factory for use with the given type of AbstractGraphicsDevice. */ public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device) { |