summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java5
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java17
3 files changed, 21 insertions, 17 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java
index ff250d27f..5b02e1fec 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLEventListenerState.java
@@ -159,7 +159,7 @@ public class GLEventListenerState {
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities();
final AbstractGraphicsScreen aScreen2 = cloneScreen(aScreen1);
if( DEBUG ) {
- System.err.println("X00 NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ System.err.println("GLEventListenerState.moveFrom.0: "+aSurface.getClass().getName()+", "+aSurface);
}
aScreen1.getDevice().clearHandleOwner(); // don't close device handle
@@ -172,7 +172,7 @@ public class GLEventListenerState {
proxyOwnsUpstreamDevice = aProxy.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
final NativeSurface aUpSurface = aProxy.getUpstreamSurface();
if(DEBUG && null != aUpSurface) {
- System.err.println("X00 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ System.err.println("GLEventListenerState.moveFrom.1: "+aUpSurface.getClass().getName()+", "+aUpSurface);
}
if(null != aUpSurface) {
final AbstractGraphicsScreen aUpScreen1 = aUpSurface.getGraphicsConfiguration().getScreen();
@@ -181,8 +181,8 @@ public class GLEventListenerState {
aUpScreen1.getDevice().clearHandleOwner(); // don't close device handle
}
if(DEBUG) {
- System.err.println("X0X NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
- System.err.println("X0X UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface);
+ System.err.println("GLEventListenerState.moveFrom.2: "+aSurface.getClass().getName()+", "+aSurface);
+ System.err.println("GLEventListenerState.moveFrom.3: "+aUpSurface.getClass().getName()+", "+aUpSurface);
}
}
} else {
@@ -256,13 +256,13 @@ public class GLEventListenerState {
// Set new Screen and close previous one
{
if( DEBUG ) {
- System.err.println("XX0 NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ System.err.println("GLEventListenerState.moveTo.0: "+aSurface.getClass().getName()+", "+aSurface);
}
final AbstractGraphicsScreen aScreen1 = aCfg.getScreen();
aCfg.setScreen( screen );
aScreen1.getDevice().close();
if( DEBUG ) {
- System.err.println("XXX NativeSurface: "+aSurface.getClass().getName()+", "+aSurface);
+ System.err.println("GLEventListenerState.moveTo.1: "+aSurface.getClass().getName()+", "+aSurface);
}
}
@@ -276,7 +276,7 @@ public class GLEventListenerState {
final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration();
if( null != upstreamScreen ) {
if( DEBUG ) {
- System.err.println("XX0 UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
+ System.err.println("GLEventListenerState.moveTo.2: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
}
aUpCfg.getScreen().getDevice().close();
aUpCfg.setScreen( upstreamScreen );
@@ -285,7 +285,7 @@ public class GLEventListenerState {
}
upstreamSet = true;
if( DEBUG ) {
- System.err.println("XXX UpstreamSurface: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
+ System.err.println("GLEventListenerState.moveTo.3: "+aUpSurface.getClass().getName()+", "+aUpSurface+", "+aProxy.getUpstreamOptionBits(null).toString());
}
} else {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true");
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index e6652cfac..592607819 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -109,6 +109,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
* {@link #pullGLEventListenerState() pull} to preserve the {@link GLEventListenerState}.
*/
public final void setPreserveGLStateAtDestroy(boolean value) {
+ if( DEBUG ) {
+ System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+Thread.currentThread().getName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ }
preserveGLELSAtDestroy = value;
}
@@ -283,7 +286,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter {
*/
protected void destroyImplInLock() {
if( preserveGLELSAtDestroy ) {
- preserveGLELSAtDestroy = false;
+ setPreserveGLStateAtDestroy(false);
pullGLEventListenerState();
}
if( null != context ) {
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index dfaa55679..448b192a2 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1066,9 +1066,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(null==newParentWindowNEWT) {
throw new NativeWindowException("Reparenting with non NEWT Window type only available after it's realized: "+newParentWindow);
}
- // Destroy this window and use parent's Screen, while trying to preserve resources.
+ // Destroy this window and use parent's Screen.
// It may be created properly when the parent is made visible.
- destroy(true);
+ destroy(false);
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
} else if(newParentWindow != getParent()) {
@@ -1091,8 +1091,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
- // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources.
- destroy(true);
+ // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
+ destroy( wasVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
} else {
@@ -1121,8 +1121,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Already Top Window
operation = ReparentOperation.ACTION_NOP;
} else if( !isNativeValid() || forceDestroyCreate ) {
- // Destroy this window and mark it for [pending] creation, while trying to preserve resources.
- destroy(true);
+ // Destroy this window and mark it for [pending] creation.
+ // If isNativeValid() and becoming visible again - try to preserve resources, i.e. b/c on-/offscreen switch.
+ destroy( isNativeValid() && wasVisible );
if( 0 < width && 0 < height ) {
operation = ReparentOperation.ACTION_NATIVE_CREATION;
} else {
@@ -1225,11 +1226,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(!ok) {
- // native reparent failed -> try creation, while trying to preserve resources.
+ // native reparent failed -> try creation, while trying to preserve resources if becoming visible again.
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: native reparenting failed ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+" -> "+toHexString(newParentWindowHandle)+" - Trying recreation");
}
- destroy(true);
+ destroy( wasVisible );
operation = ReparentOperation.ACTION_NATIVE_CREATION ;
}
}