diff options
author | Sven Gothel <[email protected]> | 2012-07-04 18:02:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-04 18:02:11 +0200 |
commit | 9b35c57425b0a5f6b789b9b43a62a8b64be51d86 (patch) | |
tree | 04a4e082e00fd4d313346aa8dfc2ce4e5d3ab145 /src/jogl/classes/jogamp/opengl/windows/wgl | |
parent | eed8508ae1132e5f45f788e9cb3f3d5a1050ac70 (diff) |
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)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl')
5 files changed, 17 insertions, 26 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index dc3b58cfa..296d53ce3 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -62,11 +62,6 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } @Override - protected void destroyImpl() { - setRealized(false); - } - - @Override protected void setRealizedImpl() { if(realized) { createBitmap(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java index 244c1553f..05d6d9862 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java @@ -70,7 +70,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { System.err.println("WindowsDummyWGLDrawable: "+config); } } catch (Throwable t) { - destroyImpl(); + setRealized(false); throw new GLException(t); } finally { unlockSurface(); @@ -96,11 +96,14 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable { } @Override - protected void destroyImpl() { - if (handleHwndLifecycle && hwnd != 0) { - GDI.ShowWindow(hwnd, GDI.SW_HIDE); - GDIUtil.DestroyDummyWindow(hwnd); - hwnd = 0; + protected void setRealizedImpl() { + super.setRealizedImpl(); + if(!realized) { + if (handleHwndLifecycle && hwnd != 0) { + GDI.ShowWindow(hwnd, GDI.SW_HIDE); + GDIUtil.DestroyDummyWindow(hwnd); + hwnd = 0; + } } } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 762bea3b1..b00c796ec 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -67,11 +67,6 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } @Override - protected void destroyImpl() { - setRealized(false); - } - - @Override protected void setRealizedImpl() { if(realized) { createPbuffer(); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index ddcb898a9..ca7886e7f 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -62,15 +62,13 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { @Override protected void setRealizedImpl() { - if(!realized) { - return; // nothing todo .. - } - - NativeSurface ns = getNativeSurface(); - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); - config.updateGraphicsConfiguration(getFactory(), ns, null); - if (DEBUG) { - System.err.println("WindowsWGLDrawable.setRealized(true): "+config); + if(realized) { + NativeSurface ns = getNativeSurface(); + WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); + config.updateGraphicsConfiguration(getFactory(), ns, null); + if (DEBUG) { + System.err.println("WindowsWGLDrawable.setRealized(true): "+config); + } } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 054e1fe90..176d27a71 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -373,7 +373,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } if (null != sr.drawable) { - sr.drawable.destroy(); + sr.drawable.setRealized(false); sr.drawable = null; } |