diff options
author | Sven Gothel <[email protected]> | 2012-07-24 00:14:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-24 00:14:02 +0200 |
commit | 00bef95008b02cc71e166da122884402e9381f44 (patch) | |
tree | 8a7a1c961b462a0d8cac49d02b1010d04ca30e38 /src/jogl/classes/jogamp/opengl/windows | |
parent | 90f2156e4c48386eb2ee06acc1169a7557851e88 (diff) |
Fix GraphicsConfigurationFactory: Map factory to device-type _and_ capabilities-type; Add a pre-set nativeVisualID to chooseGraphicsConfiguration(..)
Map factory to device-type _and_ capabilities-type:
- Allows using different GraphicsConfigurationFactory implementations for different capabilities-types.
Previous impl. failed to use an OpenGL agnostic CapabilitiesImmutable for 'chooseGraphicsConfiguration(..)'
since only the GL aware factory was mapped. The latter failed since it expected a GLCapabilitiesImmutable.
- The passed capabilities-type as well as device-type given at getFactory(..)
is traversed top-to-down to find a most suitable factory:
For-All devT := getTopDownDeviceTypes(deviceType)
For-All capsT := getTopDownCapabilitiesTypes(capabilitiesType)
f = factory.get(devT, capsT);
if(f) { return f; }
end
end
Add a pre-set nativeVisualID to chooseGraphicsConfiguration(..)
- In situations where a native visualID is already chosen [by external means for example],
but we still need to query a matching GraphicsConfiguration - we require to pass
a non VisualIDHolder.VID_UNDEFINED nativeVisualID.
We had a hack implemented before within some implementations and their static calls,
however an agnostic mechanism is required to implement new NativeSurface/Window's
platform agnostic.
- X11GLXGraphicsConfigurationFactory: respect a pre-set xvisualID
- X11GLXDrawableFactory.createProxySurfaceImpl(..) queries the given windowHandle's
visualID and 'chooses' the configuration accordingly. If the visualID is undefined
an exception is thrown, since window is invalid.
These mechanics are implicit for Windows and OSX.
Fix X11GLXGraphicsConfiguration.updateGraphicsConfiguration():
- Skip any action if a valid X11GLCapabilities is already chosen, i.e. w/ visualID.
Otherwise choose a suitable configuration incl. visualID.
The latter is quite impossible and invalid, since visualID must be defined at window creation time
and the update method is issued with a valid window.
X11 - Misc:
- Added 'int jogamp.nativewindow.x11.X11Lib.GetVisualIDFromWindow(..)'
- All returned visualID's are of type 'int'
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows')
2 files changed, 6 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index 943c7fec4..00ed91bb4 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -69,13 +69,13 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat static VisualIDHolder.VIDComparator PfdIDComparator = new VisualIDHolder.VIDComparator(VisualIDHolder.VIDType.WIN32_PFD); static void registerFactory() { - GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, new WindowsWGLGraphicsConfigurationFactory()); + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, GLCapabilitiesImmutable.class, new WindowsWGLGraphicsConfigurationFactory()); } private WindowsWGLGraphicsConfigurationFactory() { } protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { + CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { if (! (capsChosen instanceof GLCapabilitiesImmutable) ) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen"); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index bd64b58a4..3b2ff133a 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -63,14 +63,14 @@ import javax.media.opengl.GLDrawableFactory; public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory { public static void registerFactory() { - GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, new WindowsAWTWGLGraphicsConfigurationFactory()); + GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new WindowsAWTWGLGraphicsConfigurationFactory()); } private WindowsAWTWGLGraphicsConfigurationFactory() { } protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { + CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -105,11 +105,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); - GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice); + GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice, capsChosen); WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration) configFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, - chooser, winScreen); + chooser, winScreen, nativeVisualID); if (winConfig == null) { throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen); } |