From 7978096bdaac4c4bd14187382bb1f8ab9d082ebe Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 10 Apr 2013 03:22:19 +0200 Subject: GLDrawable: Refine API doc; GLDrawableImpl: Balance createHandle()/destroyHandle(); Handle LOCK_SURFACE_CHANGED in lockSurface() ; GLContextImpl.makeCurrent(): Fix drawable handle validation. GLDrawable: Refine API doc (realized/handle) - Lifecycle of the drawable handle was not clear - Ephasizing handle's dependency on NativeSurface's lock state and drawable's realization GLDrawableImpl: Balance createHandle()/destroyHandle() - updateHandle() -> createHandle() - ensure both are balance, see below GLDrawableImpl: Handle LOCK_SURFACE_CHANGED in GLDrawableImpl's lockSurface() - call destroyHandle() and createHandle() GLContextImpl.makeCurrent(): Validate drawable handle if realized only. - it is valid to have an invalid drawable handle if not realized (see above) --- .../classes/javax/media/opengl/GLDrawable.java | 70 +++++++++++++-------- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 12 ++-- src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 72 +++++++++++++++++----- .../classes/jogamp/opengl/egl/EGLDrawable.java | 4 +- .../opengl/x11/glx/X11OnscreenGLXDrawable.java | 4 +- 5 files changed, 107 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java index 95c314a48..65c8b2ea5 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java @@ -65,29 +65,31 @@ public interface GLDrawable { public GLContext createContext(GLContext shareWith); /** - * Indicates to on-screen GLDrawable implementations whether the - * underlying window has been created and can be drawn into. End - * users do not need to call this method; it is not necessary to - * call setRealized on a GLCanvas, a GLJPanel, or a - * GLPbuffer, as these perform the appropriate calls on their - * underlying GLDrawables internally. - * - *

- * + * Indicates to GLDrawable implementations whether the + * underlying {@link NativeSurface surface} has been created and can be drawn into. + *

+ * If realized, the {@link #getHandle() drawable handle} may become + * valid while it's {@link NativeSurface surface} is being {@link NativeSurface#lockSurface() locked}. + *

+ *

+ * End users do not need to call this method; it is not necessary to + * call setRealized on a {@link GLAutoDrawable} + * as these perform the appropriate calls on their underlying GLDrawables internally. + *

+ *

* Developers implementing new OpenGL components for various window * toolkits need to call this method against GLDrawables obtained - * from the GLDrawableFactory via the {@link - * GLDrawableFactory#getGLDrawable - * GLDrawableFactory.getGLDrawable()} method. It must typically be + * from the GLDrawableFactory via the + * {@link GLDrawableFactory#createGLDrawable(NativeSurface)} method. + * It must typically be * called with an argument of true when the component * associated with the GLDrawable is realized and with an argument * of false just before the component is unrealized. * For the AWT, this means calling setRealized(true) in * the addNotify method and with an argument of * false in the removeNotify method. - * - *

- * + *

+ *

* GLDrawable implementations should handle multiple * cycles of setRealized(true) / * setRealized(false) calls. Most, if not all, Java @@ -101,12 +103,11 @@ public interface GLDrawable { * GLDrawable to re-initialize and destroy any * associated resources as the component becomes realized and * unrealized, respectively. - * - *

- * + *

+ *

* With an argument of true, * the minimum implementation shall call - * {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successfull: + * {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successful: *