From 9b35c57425b0a5f6b789b9b43a62a8b64be51d86 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 4 Jul 2012 18:02:11 +0200 Subject: GLAutoDrawable* refinement of abstraction / generalization - API Change! - GLAutoDrawable (compat change - recompile): - 'void invoke(boolean wait, GLRunnable glRunnable)' -> 'boolean invoke(boolean wait, GLRunnable glRunnable)' Allows notifying caller whether the task has been executed or at least enqueued. - GLAutoDrawable add 'GLEventListener removeGLEventListener(int index)' - This allow one to remove a specific GLEventListener and reusing it (return value). - GLDrawableImpl remove 'destroy()' to favor 'setRealized(false)' - Using more common code of GLAutoDrawableBase, i.e. GLPbufferImpl can use defaultDestroyOp(). - Removes redundancy of methods - GLAutoDrawableBase/Delegate - better 'default' names to emphasize it's purpose, adding API doc - includes more generic functionality - defaultWindowDestroyNotify() - defaultDestroyOp() - TestGLAutoDrawableDelegateNEWT demonstrates a simple example w/ all window events handled. - Fix TestParenting01cSwingAWT's threading use (gl disturbance thread) --- src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 26 ++++------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/GLPbufferImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index d98b41bdc..a8277fd71 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -40,7 +40,6 @@ package jogamp.opengl; -import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; @@ -114,36 +113,19 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { @Override public void destroy() { - if(drawable.isRealized()) { - final AbstractGraphicsDevice adevice = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); - - if (null != context && context.isCreated()) { - try { - helper.disposeGL(GLPbufferImpl.this, drawable, context, null); - } catch (GLException gle) { - gle.printStackTrace(); - } - context = null; - // drawableHelper.reset(); - } - drawable.destroy(); - drawable = null; - - if(null != adevice) { - adevice.close(); - } - } + defaultDestroyOp(); } @Override public GLDrawableFactory getFactory() { - return drawable.getFactory(); + return drawable.getFactory(); } @Override public void display() { - if( null == drawable || !drawable.isRealized() || null == context ) { return; } + if( null != drawable && drawable.isRealized() && null != context ) { helper.invokeGL(drawable, context, defaultDisplayAction, initAction); + } } //---------------------------------------------------------------------- -- cgit v1.2.3