diff options
author | Sven Gothel <[email protected]> | 2012-07-20 22:05:32 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-20 22:05:32 +0200 |
commit | e58e7739379147af8c7b875f6e8a7cdb40e342bc (patch) | |
tree | b74531fe8dee6d27215169325347860ce616b3e7 /src/nativewindow | |
parent | fb7d2d8a188fe5da159571cfabfd1d6a8879d1da (diff) |
Fix OSX OffscreenLayerSurface (OLS) regressions (pbuffer based)
- Use pbuffer (still), don't set FBO (invisible)
- OLS (only impl is JAWTWindow now) stores the attached layer handle
created and attached by the GLContext implementation,
so 'others' may detach it -> NewtCanvasAWT
- NewtCanvasAWT.removeNotify() needs to ask the OLS to detach the layer
since it's parent will be gone.
- MacOSXCGLContext destroy allows a removed OLS (see above)
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 18 | ||||
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java | 9 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index cffe495f7..d4b927cf1 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -81,6 +81,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected long drawable; protected Rectangle bounds; protected Insets insets; + private long offscreenSurfaceLayer; private long drawable_old; @@ -106,6 +107,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, invalidate(); this.component = windowObject; this.isApplet = false; + this.offscreenSurfaceLayer = 0; } @Override @@ -196,6 +198,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, System.err.println("JAWTWindow.attachSurfaceHandle(): 0x"+Long.toHexString(layerHandle) + ", bounds "+bounds); } attachSurfaceLayerImpl(layerHandle); + offscreenSurfaceLayer = layerHandle; } finally { unlockSurface(); } @@ -206,25 +209,34 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * {@inheritDoc} */ @Override - public final void detachSurfaceLayer(final long layerHandle) throws NativeWindowException { + public final void detachSurfaceLayer() throws NativeWindowException { if( !isOffscreenLayerSurfaceEnabled() ) { throw new java.lang.UnsupportedOperationException("Not an offscreen layer surface"); } + if( 0 == offscreenSurfaceLayer) { + throw new NativeWindowException("No offscreen layer attached: "+this); + } int lockRes = lockSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { throw new NativeWindowException("Could not lock (offscreen layer): "+this); } try { if(DEBUG) { - System.err.println("JAWTWindow.detachSurfaceHandle(): 0x"+Long.toHexString(layerHandle)); + System.err.println("JAWTWindow.detachSurfaceHandle(): 0x"+Long.toHexString(offscreenSurfaceLayer)); } - detachSurfaceLayerImpl(layerHandle); + detachSurfaceLayerImpl(offscreenSurfaceLayer); + offscreenSurfaceLayer = 0; } finally { unlockSurface(); } } protected abstract void detachSurfaceLayerImpl(final long layerHandle); + @Override + public final boolean isSurfaceLayerAttached() { + return 0 != offscreenSurfaceLayer; + } + // // SurfaceUpdateListener // diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java index dd36509ba..f7dbc6c27 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java @@ -42,7 +42,12 @@ public interface OffscreenLayerSurface { * Detaches a previously attached offscreen layer from this offscreen layer surface. * @see #attachSurfaceLayer(long) * @see #isOffscreenLayerSurfaceEnabled() - * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false + * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false + * or no surface layer is attached. */ - public void detachSurfaceLayer(final long layerHandle) throws NativeWindowException; + public void detachSurfaceLayer() throws NativeWindowException; + + /** Returns true if a surface layer is attached, otherwise false. */ + public boolean isSurfaceLayerAttached(); + } |