diff options
author | Sven Gothel <[email protected]> | 2013-01-24 17:24:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-24 17:24:22 +0100 |
commit | b738983638703bb721ee4c9820c8ef43e2252e73 (patch) | |
tree | 5543e1be50c497619b6902676e7f66fdfaea78cd /src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java | |
parent | 85d70b7d38885fa8ba6374aa790d5a296acc8ec1 (diff) |
Bug 665 (part 1) - Allow dis-association of GLContext's GLDrawable ..
Changes allowing re-association (incl. null) of GLContext/GLDrawable:
- GLAutoDrawable: Refine API doc 'setContext(..)'
- GLContext: Refine API doc: 'setGLDrawable(..)' 'getGLDrawable()'
- GLContextImpl.setGLDrawable(): Handle null drawable
- GLAutoDrawableDelegate/GLAutoDrawableBase: Allow null GLContext
- GLDrawableHelper.switchContext(..)/recreateGLDrawable(): Balance GLContext.setGLDrawable(..) calls
- New GLEventListenerState, holding state vector [GLEventListener, GLContext, .. ]
impl. relocation of all components from/to GLAutoDrawable.
- GLDrawableUtil
- Using GLEventListenerState for swapGLContextAndAllGLEventListener(..)
+++
NEWT Window*:
- getDisplayHandle() is 'final', no more 'shortcut' code allowed
due to re-association incl. display handle.
- close*:
- close config's device (was missing)
- null config
+++
Changes allowing reconfig of Display handle as required
to re-associate pre-existing GLContext to a 'window':
- AbstractGraphicsDevice: Add isHandleOwner() / clearHandleOwner()
- Impl. in X11GraphicsDevice and EGLGraphicsDevice, NOP in DefaultGraphicsDevice
- DefaultGraphicsConfiguration add 'setScreen(..)'
- MutableGraphicsConfiguration
- Make DefaultGraphicsConfiguration.setScreen(..) public
- NativeWindowFactory add 'createScreen(String type, AbstractGraphicsDevice device, int screen)'
- Refactored from SWTAccessor
- NativeWindow x11ErrorHandler: Dump Stack Trace in DEBUG mode, always.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index eadd59559..c20197e72 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -74,8 +74,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { protected volatile boolean sendDestroy = false; // volatile: maybe written by WindowManager thread w/o locking /** - * @param drawable upstream {@link GLDrawableImpl} instance, may be null for lazy initialization - * @param context upstream {@link GLContextImpl} instance, may be null for lazy initialization + * @param drawable upstream {@link GLDrawableImpl} instance, + * may be <code>null</code> for lazy initialization + * @param context upstream {@link GLContextImpl} instance, + * may not have been made current (created) yet, + * may not be associated w/ <code>drawable<code> yet, + * may be <code>null</code> for lazy initialization * @param ownsDevice pass <code>true</code> if {@link AbstractGraphicsDevice#close()} shall be issued, * otherwise pass <code>false</code>. Closing the device is required in case * the drawable is created w/ it's own new instance, e.g. offscreen drawables, @@ -85,6 +89,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { this.drawable = drawable; this.context = context; this.ownsDevice = ownsDevice; + if(null != context && null != drawable) { + context.setGLDrawable(drawable, false); + } resetFPSCounter(); } @@ -326,7 +333,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { final GLContext oldCtx = context; final boolean newCtxCurrent = GLDrawableHelper.switchContext(drawable, oldCtx, newCtx, additionalCtxCreationFlags); context=(GLContextImpl)newCtx; - if(newCtxCurrent) { + if(newCtxCurrent) { // implies null != newCtx context.makeCurrent(); } return oldCtx; |