diff options
author | Sven Gothel <[email protected]> | 2011-11-23 06:10:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-23 06:10:56 +0100 |
commit | e341ad8db546530b3a49c56c32cc26980e296201 (patch) | |
tree | b233ef6a5b53e988930b5182c203740afd561be5 /src/jogl/classes/jogamp/opengl/x11 | |
parent | c623e1657500a645243ccf0e045292da42fde718 (diff) |
X11GLXDrawableFactory.createOffscreenSurfaceImpl(): Create own screen/device instance pair
Don't use the shared device due to locking issues on X11.
Other platform impl. usually don't have native semantics on device/screen and may use it.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index d040775ed..28cff2629 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -407,19 +407,25 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return isGLXVersionGreaterEqualOneThree(device); } - protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, + protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) { - X11GraphicsScreen screen = null; - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device); - if(null!=sr) { - screen = (X11GraphicsScreen) sr.getScreen(); + if(null == deviceReq) { + throw new InternalError("deviceReq is null"); } - if(null==screen) { - return null; + final SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(deviceReq); + if(null==sr) { + throw new InternalError("No SharedResource for: "+deviceReq); } - + final X11GraphicsScreen sharedScreen = (X11GraphicsScreen) sr.getScreen(); + final AbstractGraphicsDevice sharedDevice = sharedScreen.getDevice(); // should be same .. + + // create screen/device pair + X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(sharedDevice.getConnection()), AbstractGraphicsDevice.DEFAULT_UNIT); + device.setCloseDisplay(true); + X11GraphicsScreen screen = new X11GraphicsScreen(device, sharedScreen.getIndex()); + WrappedSurface ns = new WrappedSurface( X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) ); if(ns != null) { |