aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-03-13 07:12:59 +0100
committerSven Gothel <[email protected]>2013-03-13 07:12:59 +0100
commite2506d7663b752f00f0a98f793ebad52e65bd1e3 (patch)
tree66e669f22824892aec2d157aca5c384f1bd348c4 /src/newt/classes/com
parentc225285e09f0a29fca418601bf1aa07cafb54339 (diff)
Bug 665: Allow re-association of GLContext/GLEventListener to a GLDrawable (Part 5)
- GLAutoDrawableBase: - Add 'setPreserveGLStateAtDestroy(..)' to preserve the GLEventListenerState at destroy() operation, and impl. details pullGLEventListenerState()/pushGLEventListenerState(). pullGLEventListenerState() is called automatic at destroyImplInLock(), where pushGLEventListenerState() has to be called after drawable realization instead of context creation. - Note/TODO: Method will become public in GLAutoDrawable in general! - NEWT/GLWindow: - Use GLEventListenerState preservation for reparenting case w/ destruction, i.e. keep GLContext/GLEventListener alive while reparenting in recreation mode. Scenario: NewtCanvasAWT Child <-> Top on OSX w/ CALayer
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index ce50d95dd..33f136460 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -421,6 +421,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
protected class GLLifecycleHook implements WindowImpl.LifecycleHook {
@Override
+ public void setPreserveResourcesAtDestroy() {
+ GLWindow.this.setPreserveGLStateAtDestroy(true);
+ }
+
+ @Override
public synchronized void destroyActionPreLock() {
// nop
}
@@ -433,7 +438,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
//Exception e1 = new Exception(msg);
//e1.printStackTrace();
}
-
+
destroyImplInLock();
if(Window.DEBUG_IMPLEMENTATION) {
@@ -479,8 +484,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
drawable = (GLDrawableImpl) factory.createGLDrawable(nw);
drawable.setRealized(true);
- context = (GLContextImpl) drawable.createContext(sharedContext);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+
+ if( !GLWindow.this.pushGLEventListenerState() ) {
+ context = (GLContextImpl) drawable.createContext(sharedContext);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
}
if(Window.DEBUG_IMPLEMENTATION) {
System.err.println("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+WindowImpl.getThreadName()+", fin: dt "+ (System.nanoTime()-t0)/1e6 +"ms");
@@ -512,7 +520,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
//
private GLContext sharedContext = null;
-
+
@Override
protected final RecursiveLock getLock() {
return window.getLock();
@@ -571,10 +579,6 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public final void setRealized(boolean realized) {
- }
-
- @Override
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}