summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/windows/wgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl')
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index d65027f0d..16d6a8532 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -316,7 +316,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Couldn't get default GLProfile for device: "+device);
}
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
- final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64));
+ final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, device, false, caps, caps, null, 64, 64));
drawable.setRealized(true);
context = (GLContextImpl) drawable.createContext(null);
@@ -549,42 +549,48 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested,
final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) {
final WindowsGraphicsDevice device;
+ final boolean owning;
if(createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice)) {
device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID());
+ owning = true;
} else {
device = (WindowsGraphicsDevice)deviceReq;
+ owning = false;
}
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen);
if(null == config) {
throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
}
- return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
+ return new WrappedSurface(config, 0, upstreamHook, owning);
}
@Override
- public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
- GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
- final WindowsGraphicsDevice device;
- if( createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice) ) {
- device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID());
+ public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceOrig, final AbstractGraphicsDevice device,
+ final boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ final WindowsGraphicsDevice device0;
+ final boolean owning;
+ if( createNewDevice || !(device instanceof WindowsGraphicsDevice) ) {
+ device0 = new WindowsGraphicsDevice(device.getConnection(), device.getUnitID());
+ owning = true;
} else {
- device = (WindowsGraphicsDevice)deviceReq;
+ device0 = (WindowsGraphicsDevice)device;
+ owning = false;
}
- final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
+ final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device0, 0);
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(chosenCaps, requestedCaps, chooser, screen);
if(null == config) {
throw new GLException("Choosing GraphicsConfiguration failed w/ "+chosenCaps+" on "+screen);
}
- return new GDISurface(config, 0, new GDIDummyUpstreamSurfaceHook(width, height), createNewDevice);
+ return new GDISurface(config, 0, new GDIDummyUpstreamSurfaceHook(width, height), owning);
}
@Override
- public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
- GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceOrig, final AbstractGraphicsDevice device,
+ final boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
- return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height));
+ return createMutableSurfaceImpl(device, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height));
}
@Override