diff options
38 files changed, 182 insertions, 327 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index b78f7a9e8..5b3d93eec 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -109,19 +109,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * which will issue {@link Screen#destroy()} if the reference count becomes 0.<br> * This destruction sequence shall end up in {@link Display#destroy()}, if all reference counts become 0. * </p> - * @see #invalidate() + * @see #destroy() * @see #setVisible(boolean) */ void destroy(); /** - * Destroys the Window via {@link #destroy()} and clears all Object references, - * eg. all states, size, position, parent handles, list of child Windows and reference to it's Screen.<br> - * This Window cannot be recreated after calling this method anymore.<br> - */ - void invalidate(); - - /** * <p> * <code>setVisible</code> makes the window and children visible if <code>visible</code> is true, * otherwise the window and children becomes invisible.<br></p> diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index bc0d67bfc..d8eda923a 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -341,28 +341,18 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC } context = null; drawable = null; - + + GLAnimatorControl ctrl = GLWindow.this.getAnimator(); + if ( null!=ctrl ) { + ctrl.remove(GLWindow.this); + } + // helper=null; // pending events .. + if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { System.err.println("GLWindow.destroy() "+Thread.currentThread()+", fin"); } } - public synchronized void invalidate(boolean unrecoverable) { - if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = "GLWindow.invalidate("+unrecoverable+") "+Thread.currentThread()+", start"; - System.err.println(msg); - //Exception e1 = new Exception(msg); - //e1.printStackTrace(); - } - if(unrecoverable) { - GLAnimatorControl ctrl = GLWindow.this.getAnimator(); - if ( null!=ctrl ) { - ctrl.remove(GLWindow.this); - } - helper=null; - } - } - public synchronized void resetCounter() { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { System.err.println("GLWindow.resetCounter() "+Thread.currentThread()); @@ -407,19 +397,20 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC } } + private GLAnimatorControl savedAnimator = null; + public synchronized boolean pauseRenderingAction() { boolean animatorPaused = false; - GLAnimatorControl ctrl = GLWindow.this.getAnimator(); - if ( null!=ctrl ) { - animatorPaused = ctrl.pause(); + savedAnimator = GLWindow.this.getAnimator(); + if ( null != savedAnimator ) { + animatorPaused = savedAnimator.pause(); } return animatorPaused; } public synchronized void resumeRenderingAction() { - GLAnimatorControl ctrl = GLWindow.this.getAnimator(); - if ( null!=ctrl && ctrl.isPaused() ) { - ctrl.resume(); + if ( null != savedAnimator && savedAnimator.isPaused() ) { + savedAnimator.resume(); } } } @@ -849,10 +840,6 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC return window.surfaceSwap(); } - public final void invalidate() { - window.invalidate(); - } - public final long getWindowHandle() { return window.getWindowHandle(); @@ -917,7 +904,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC }); glWindow.setVisible(true); - glWindow.invalidate(); + glWindow.destroy(); } } diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java index 3b14f30fc..847407683 100644 --- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java +++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java @@ -135,7 +135,7 @@ public class DefaultEDTUtil implements EDTUtil { if(stop) { edt.shouldStop = true; if(DEBUG) { - String msg = Thread.currentThread()+": EDT signal STOP (on edt: "+isCurrentThreadEDT()+") - edt: "+edt; + String msg = Thread.currentThread()+": EDT signal STOP (on edt: "+isCurrentThreadEDT()+") - tasks: "+edt.tasks.size()+" - "+edt; System.err.println(msg); // Throwable t = new Throwable(msg); // t.printStackTrace(); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index cb1c0eda2..2286fdd00 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -75,16 +75,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private RecursiveLock windowLock = new RecursiveLock(); // Window instance wide lock private RecursiveLock surfaceLock = new RecursiveLock(); // Surface only lock - private long windowHandle; - private ScreenImpl screen; + private long windowHandle = 0; + private ScreenImpl screen = null; private boolean screenReferenceAdded = false; - private NativeWindow parentWindow; - private long parentWindowHandle; - protected AbstractGraphicsConfiguration config; - protected CapabilitiesImmutable capsRequested; + private NativeWindow parentWindow = null; + private long parentWindowHandle = 0; + protected AbstractGraphicsConfiguration config = null; + protected CapabilitiesImmutable capsRequested = null; protected CapabilitiesChooser capabilitiesChooser = null; // default null -> default - protected boolean fullscreen, visible, hasFocus; - protected int width, height, x, y; + protected boolean fullscreen = false, visible = false, hasFocus = false; + protected int width = 128, height = 128, x = 0, y = 0; // default values + protected int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen dimensions .. protected String title = "Newt Window"; protected boolean undecorated = false; @@ -99,37 +100,23 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private FocusRunnable focusAction = null; private Object surfaceUpdatedListenersLock = new Object(); - private ArrayList surfaceUpdatedListeners; + private ArrayList surfaceUpdatedListeners = new ArrayList(); private Object childWindowsLock = new Object(); - private ArrayList childWindows; + private ArrayList childWindows = new ArrayList(); - private ArrayList mouseListeners; - private int mouseButtonPressed; // current pressed mouse button number - private long lastMousePressed; // last time when a mouse button was pressed - private int lastMouseClickCount; // last mouse button click count + private ArrayList mouseListeners = new ArrayList(); + private int mouseButtonPressed = 0; // current pressed mouse button number + private long lastMousePressed = 0; // last time when a mouse button was pressed + private int lastMouseClickCount = 0; // last mouse button click count - private ArrayList keyListeners; + private ArrayList keyListeners = new ArrayList(); - private ArrayList windowListeners; + private ArrayList windowListeners = new ArrayList(); private boolean repaintQueued = false; ScreenModeListenerImpl screenModeListenerImpl = new ScreenModeListenerImpl(); - private void initializeStates() { - invalidate(true); - - childWindows = new ArrayList(); - surfaceUpdatedListeners = new ArrayList(); - windowListeners = new ArrayList(); - mouseListeners = new ArrayList(); - - mouseButtonPressed = 0; // current pressed mouse button number - lastMousePressed = 0; // last time when a mouse button was pressed - lastMouseClickCount = 0; // last mouse button click count - keyListeners = new ArrayList(); - } - // Workaround for initialization order problems on Mac OS X // between native Newt and (apparently) Fmod -- if Fmod is // initialized first then the connection to the window server @@ -179,7 +166,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer windowClass = OffscreenWindow.class; } WindowImpl window = (WindowImpl) windowClass.newInstance(); - window.initializeStates(); window.parentWindow = parentWindow; window.parentWindowHandle = parentWindowHandle; window.screen = (ScreenImpl) screen; @@ -204,7 +190,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException("WindowClass "+windowClass+" constructor mismatch at argument #"+argsChecked+"; Constructor: "+getTypeStrList(cstrArgumentTypes)+", arguments: "+getArgsStrList(cstrArguments)); } WindowImpl window = (WindowImpl) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ; - window.initializeStates(); window.screen = (ScreenImpl) screen; window.capsRequested = (CapabilitiesImmutable) caps.cloneMutable(); return window; @@ -244,13 +229,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer void destroyActionInLock(); /** - * Invoked after destruction from Window's invalidate method.<br> - * Called while window is locked. - * @param unrecoverable - */ - void invalidate(boolean unrecoverable); - - /** * Invoked for expensive modifications, ie while reparenting and ScreenMode change.<br> * No lock is hold when invoked.<br> * @@ -310,26 +288,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - private void closeAndInvalidate() { - windowLock.lock(); - try { - if( null != screen ) { - if( 0 != windowHandle ) { - screen.removeScreenModeListener(screenModeListenerImpl); - closeNativeImpl(); - removeScreenReference(); - } - Display dpy = screen.getDisplay(); - if(null != dpy) { - dpy.validateEDT(); - } - } - invalidate(false); - } finally { - windowLock.unlock(); - } - } - private boolean validateParentWindowHandle() { if(null!=parentWindow) { parentWindowHandle = getNativeWindowHandle(parentWindow); @@ -765,6 +723,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return; // nop } + if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { + String msg = "!!! Window DestroyAction() "+getThreadName(); + System.err.println(msg); + } // Childs first .. synchronized(childWindowsLock) { if(childWindows.size()>0) { @@ -787,7 +749,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer lifecycleHook.destroyActionInLock(); } - closeAndInvalidate(); + if( null != screen ) { + if( 0 != windowHandle ) { + screen.removeScreenModeListener(screenModeListenerImpl); + closeNativeImpl(); + removeScreenReference(); + } + Display dpy = screen.getDisplay(); + if(null != dpy) { + dpy.validateEDT(); + } + } // send synced destroyed notification sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROYED); @@ -800,7 +772,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(animatorPaused) { lifecycleHook.resumeRenderingAction(); - } + } + windowHandle = 0; + visible = false; + fullscreen = false; + hasFocus = false; + parentWindowHandle = 0; + + // these refs shall be kept alive - resurrection + /** + if(null!=parentWindow && parentWindow instanceof Window) { + ((Window)parentWindow).removeChild(WindowImpl.this); + } + childWindows = null; + surfaceUpdatedListeners = null; + mouseListeners = null; + keyListeners = null; + capsRequested = null; + lifecycleHook = null; + + screen = null; + windowListeners = null; + parentWindow = null; + */ } } @@ -816,84 +810,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - public final void invalidate() { - destroy(); - invalidate(true); - } - - /** - * @param unrecoverable If true, all states, size, position, parent handles, - * reference to it's Screen are reset. - * Otherwise you can recreate the window, via <code>setVisible(true)</code>. - * @see #invalidate() - * @see #destroy() - * @see #destroy(boolean) - */ - protected void invalidate(boolean unrecoverable) { - windowLock.lock(); - try { - if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { - String msg = "!!! Window Invalidate(unrecoverable: "+unrecoverable+") "+getThreadName(); - System.err.println(msg); - // Throwable t = new Throwable(msg); - // t.printStackTrace(); - } - - // Childs first .. - synchronized(childWindowsLock) { - // avoid ConcurrentModificationException: parent -> child -> parent.removeChild(this) - if(null!=childWindows && childWindows.size()>0) { - ArrayList clonedChildWindows = (ArrayList) childWindows.clone(); - while( clonedChildWindows.size() > 0 ) { - NativeWindow nw = (NativeWindow) clonedChildWindows.remove(0); - if(nw instanceof WindowImpl) { - ((WindowImpl)nw).invalidate(unrecoverable); - } - } - } - } - - if(null!=lifecycleHook) { - lifecycleHook.invalidate(unrecoverable); - } - - windowHandle = 0; - visible = false; - fullscreen = false; - hasFocus = false; - - if(unrecoverable) { - if(null!=parentWindow && parentWindow instanceof Window) { - ((Window)parentWindow).removeChild(WindowImpl.this); - } - screen = null; - - synchronized(childWindowsLock) { - childWindows = null; - } - synchronized(surfaceUpdatedListenersLock) { - surfaceUpdatedListeners = null; - } - windowListeners = null; - mouseListeners = null; - keyListeners = null; - - parentWindowHandle = 0; - parentWindow = null; - capsRequested = null; - lifecycleHook = null; - - // Default position and dimension will be re-set immediately by user - width = 128; - height = 128; - x=0; - y=0; - } - } finally { - windowLock.unlock(); - } - } - private class ReparentActionImpl implements Runnable, ReparentAction { NativeWindow newParentWindow; boolean forceDestroyCreate; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java index d4f24bb19..898337602 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -155,7 +155,7 @@ public class TestGLProfile01NEWT extends UITestCase { glWindow.display(); Thread.sleep(100); - glWindow.invalidate(); + glWindow.destroy(); } public static void main(String args[]) throws IOException { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index 0793d113e..9f515c1b5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -120,7 +120,7 @@ public class TestSharedContextListAWT extends UITestCase { GLCanvas glc2 = runTestGL(f2, animator, width, 0, true); GLCanvas glc3 = runTestGL(f3, animator, 0, height, false); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 0662ed72e..f3a3cd04e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -108,7 +108,7 @@ public class TestSharedContextListNEWT extends UITestCase { GLWindow f1 = runTestGL(animator, 0, 0, true); GLWindow f2 = runTestGL(animator, width, 0, true); GLWindow f3 = runTestGL(animator, 0, height, false); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java index 3e08f0e82..ce927ddc7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java @@ -58,16 +58,16 @@ public class RedSquare0 implements GLEventListener { myShader = GLSLSimpleProgram.create(gl, RedSquareShader.VERTEX_SHADER_TEXT, RedSquareShader.FRAGMENT_SHADER_TEXT, true); gl.glUseProgram(myShader.getShaderProgram()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - // setup mgl_PMVMatrix + // setup gcu_PMVMatrix pmvMatrix = new PMVMatrix(); pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - mgl_PMVMatrix = gl.glGetUniformLocation(myShader.getShaderProgram(), "mgl_PMVMatrix"); + mgl_PMVMatrix = gl.glGetUniformLocation(myShader.getShaderProgram(), "gcu_PMVMatrix"); Assert.assertTrue(0 <= mgl_PMVMatrix); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); pmvMatrixUniform.setLocation(mgl_PMVMatrix); gl.glUniform(pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java index 3ef62df31..ca781f4ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java @@ -38,7 +38,7 @@ public class RedSquareShader { " #define HIGHP\n" + "#endif\n" + "\n" + - "uniform MEDIUMP mat4 mgl_PMVMatrix[2];\n" + + "uniform MEDIUMP mat4 gcu_PMVMatrix[2];\n" + "attribute HIGHP vec4 mgl_Vertex;\n" + "attribute HIGHP vec4 mgl_Color;\n" + "varying HIGHP vec4 frontColor;\n" + @@ -46,7 +46,7 @@ public class RedSquareShader { "void main(void)\n" + "{\n" + " frontColor=mgl_Color;\n" + - " gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;\n" + + " gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * mgl_Vertex;\n" + "}\n" ; public static String FRAGMENT_SHADER_TEXT = diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java index 77a19cb17..8b050374a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java @@ -81,7 +81,7 @@ public class TestGearsAWT extends UITestCase { new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); frame.setVisible(true); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java index 6965fc4c0..148181cd9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java @@ -84,7 +84,7 @@ public class TestGearsGLJPanelAWT extends UITestCase { _frame.setVisible(true); } } ) ; - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); Assert.assertEquals(true, animator.isAnimating()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java index 3abb27289..e8da62b50 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java @@ -114,7 +114,7 @@ public class TestGearsGLJPanelAWTBug450 extends UITestCase { _frame.setVisible(true); } } ) ; - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); Assert.assertEquals(true, animator.isAnimating()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java index 536f5ef39..90c209e9b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java @@ -100,7 +100,7 @@ public class TestGearsNEWT extends UITestCase { glWindow.setSize(width, height); glWindow.setVisible(true); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { @@ -108,7 +108,7 @@ public class TestGearsNEWT extends UITestCase { } animator.stop(); - glWindow.invalidate(); + glWindow.destroy(); } @Test diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java index 03a2f0f6a..4fe946b88 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java @@ -81,7 +81,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { glWindow.setSize(width, height); glWindow.setVisible(true); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { @@ -89,7 +89,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { } animator.stop(); - glWindow.invalidate(); + glWindow.destroy(); } @Test diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java index 8897dc6fe..5568b42f7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java @@ -145,7 +145,7 @@ public class TestDrawable01NEWT extends UITestCase { // GLWindow.destroy(..) sequence cont.. Assert.assertNotNull(window); - window.invalidate(); + window.destroy(); drawable = null; context = null; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java index 1bbf37159..e3d275845 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java @@ -136,7 +136,7 @@ public class TestShaderCompilationBug459AWT extends UITestCase { Animator animator = new Animator(glCanvas); frame.setVisible(true); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index 21a97363c..aed101ae5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -68,7 +68,7 @@ import org.junit.AfterClass; import org.junit.Test; public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { - static long durationPerTest = 500; // ms + static long durationPerTest = 150; // ms static Robot robot; static Border border; static JFrame frame; @@ -265,13 +265,12 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { runTestGL(newtCanvasAWT, win1); win0.destroy(); - Assert.assertEquals(true, anim.isAnimating()); - - newtCanvasAWT.destroy(); + Assert.assertEquals(false, win0.isNativeValid()); + Assert.assertEquals(true, anim.isAnimating()); // due to newtCanvasAWT/win1 - win0.invalidate(); - Assert.assertEquals(true, anim.isAnimating()); - win1.invalidate(); + newtCanvasAWT.destroy(); // destroys both newtCanvasAWT/win1 + Assert.assertEquals(false, win0.isNativeValid()); + Assert.assertEquals(false, win1.isNativeValid()); Assert.assertEquals(false, anim.isAnimating()); anim.stop(); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java index 8905a7637..8e8e50899 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -83,7 +83,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { } else { glWindow = GLWindow.create(caps); } - glWindow.setUpdateFPSFrames(1, System.err); + glWindow.setUpdateFPSFrames(1, null); GLEventListener demo = new Gears(); setDemoFields(demo, glWindow); @@ -114,7 +114,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); Assert.assertNotNull(window.getScreen()); - Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -170,7 +169,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,display.getEDTUtil().isRunning()); Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); - Assert.assertEquals(true, window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); window.resetFPSCounter(); @@ -217,7 +215,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); Assert.assertNotNull(window.getScreen()); - Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java index bd8ece22d..39f00100a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -76,7 +76,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // Create native windowing resources .. X11/Win/OSX // GLWindow glWindow = GLWindow.create(caps); - glWindow.setUpdateFPSFrames(1, System.err); + glWindow.setUpdateFPSFrames(1, null); GLEventListener demo = new Gears(); setDemoFields(demo, glWindow); @@ -161,7 +161,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); Assert.assertNotNull(window.getScreen()); - Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -180,7 +179,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(1,display.getReferenceCount()); - Assert.assertEquals(true,window.isValid()); Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,display.getEDTUtil().isRunning()); Assert.assertEquals(1,Screen.getActiveScreenNumber()); @@ -197,10 +195,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { } System.err.println("duration: "+window.getTotalFPSDuration()); - // destruction + invalidate, ie Display/Screen will be unreferenced - window.invalidate(); - Assert.assertNull(window.getScreen()); - Assert.assertEquals(false,window.isValid()); + window.destroy(); + Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -300,7 +296,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // destruction ... window1.destroy(); Assert.assertNotNull(window1.getScreen()); - Assert.assertEquals(true,window1.isValid()); Assert.assertEquals(false,window1.isNativeValid()); Assert.assertEquals(false,window1.isVisible()); @@ -316,7 +311,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // destruction window2.destroy(); Assert.assertNotNull(window2.getScreen()); - Assert.assertEquals(true,window2.isValid()); Assert.assertEquals(false,window2.isNativeValid()); Assert.assertEquals(false,window2.isVisible()); @@ -331,16 +325,12 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); // invalidate .. remove all refs - window1.invalidate(); - Assert.assertNull(window1.getScreen()); - Assert.assertEquals(false,window1.isValid()); + window1.destroy(); Assert.assertEquals(false,window1.isNativeValid()); Assert.assertEquals(false,window1.isVisible()); // invalidate .. remove all refs - window2.invalidate(); - Assert.assertNull(window2.getScreen()); - Assert.assertEquals(false,window2.isValid()); + window2.destroy(); Assert.assertEquals(false,window2.isNativeValid()); Assert.assertEquals(false,window2.isVisible()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java index 67dd2a33c..ff0da663c 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java @@ -88,7 +88,7 @@ public class TestEventSourceNotAWTBug extends UITestCase { f_jf.dispose(); } }); - glWindow.invalidate(); + glWindow.destroy(); } public static void main(String args[]) throws IOException { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java index 31170d32d..8be7d1c85 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java @@ -175,7 +175,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase { // Shutdown the test. animator.stop(); frame1.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } static int atoi(String a) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java index 8242ebb32..996ce9ca8 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -261,7 +261,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase { _jFrame1.dispose(); } }); - glWindow1.invalidate(); + glWindow1.destroy(); } @Test diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java index 661cdc517..9864ae164 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java @@ -71,7 +71,7 @@ public class TestGLWindows00NEWT extends UITestCase { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); } - glWindow.setUpdateFPSFrames(1, System.err); + glWindow.setUpdateFPSFrames(1, null); GLEventListener demo = new Gears(); glWindow.addGLEventListener(demo); @@ -86,9 +86,8 @@ public class TestGLWindows00NEWT extends UITestCase { static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.invalidate(); + glWindow.destroy(); Assert.assertEquals(false,glWindow.isNativeValid()); - Assert.assertEquals(false,glWindow.isValid()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java index 2d0007ecb..0b6c754ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java @@ -119,9 +119,8 @@ public class TestGLWindows01NEWT extends UITestCase { static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.invalidate(); + glWindow.destroy(); Assert.assertEquals(false,glWindow.isNativeValid()); - Assert.assertEquals(false,glWindow.isValid()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java index 6cf1b2223..21ef2da06 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -74,7 +74,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { } else { glWindow = GLWindow.create(caps); } - glWindow.setUpdateFPSFrames(1, System.err); + glWindow.setUpdateFPSFrames(1, null); Assert.assertNotNull(glWindow); glWindow.setUndecorated(onscreen && undecorated); @@ -119,13 +119,15 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertNotNull(caps); GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */); Animator animator = new Animator(window); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); Assert.assertTrue(animator.start()); while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } destroyWindow(window); - Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isAnimating()); + Assert.assertEquals(false, animator.isPaused()); + Assert.assertEquals(true, animator.isStarted()); Assert.assertTrue(animator.stop()); } @@ -135,14 +137,16 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertNotNull(caps); GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */); Animator animator = new Animator(window); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); Assert.assertTrue(animator.start()); while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } destroyWindow(window); destroyWindow(window); - Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isAnimating()); + Assert.assertEquals(false, animator.isPaused()); + Assert.assertEquals(true, animator.isStarted()); Assert.assertTrue(animator.stop()); } @@ -165,7 +169,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { window2.setPosition(screen.getWidth()-width, 0); Animator animator = new Animator(); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -188,7 +192,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } - window1.invalidate(); + window1.destroy(); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -196,7 +200,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { while(animator.isAnimating() && animator.getTotalFPSDuration()<2*durationPerTest) { Thread.sleep(100); } - window2.invalidate(); + window2.destroy(); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -227,7 +231,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { window2.setPosition(screen2.getWidth()-width, 0); Animator animator = new Animator(); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -260,17 +264,17 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { } destroyWindow(window2); Assert.assertEquals(true, animator.isStarted()); - Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); Assert.assertEquals(true, animator.pause()); - Assert.assertEquals(true, animator.isStarted()); + Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(true, animator.isPaused()); Assert.assertEquals(true, animator.resume()); Assert.assertEquals(true, animator.isStarted()); - Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); Assert.assertTrue(animator.stop()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java index 3eac407d2..1b65c8910 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java @@ -109,7 +109,7 @@ public class TestListenerCom01AWT extends UITestCase { frame.setVisible(true); Animator animator1 = new Animator(glWindow); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); @@ -120,7 +120,7 @@ public class TestListenerCom01AWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow.invalidate(); + glWindow.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java index da4a0b2d4..579355900 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -89,9 +89,8 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.invalidate(); + glWindow.destroy(); Assert.assertEquals(false,glWindow.isNativeValid()); - Assert.assertEquals(false,glWindow.isValid()); } } @@ -137,7 +136,7 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window2.isVisible()); animator.add(window2); - animator.setUpdateFPSFrames(1, System.err); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.getTotalFPSDuration()<durationPerTest) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java index d16330ecc..810539c90 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java @@ -120,7 +120,7 @@ public class TestScreenMode00NEWT extends UITestCase { System.err.println("Your platform has no ScreenMode change support, sorry"); } - window.invalidate(); + window.destroy(); Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java index 8f5baece9..fb19f6d50 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java @@ -70,7 +70,6 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { Assert.assertEquals(WindowClosingProtocol.DO_NOTHING_ON_CLOSE, op); Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, false)); // nop - Assert.assertEquals(true, glWindow.isValid()); Assert.assertEquals(true, glWindow.isNativeValid()); Assert.assertEquals(true, windowClosingListener.isWindowClosing()); windowClosingListener.reset(); @@ -83,7 +82,6 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { Assert.assertEquals(WindowClosingProtocol.DISPOSE_ON_CLOSE, op); Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, true)); - Assert.assertEquals(true, glWindow.isValid()); Assert.assertEquals(false, glWindow.isNativeValid()); Assert.assertEquals(true, windowClosingListener.isWindowClosing()); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java index a10730680..2fc84cd91 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -79,7 +79,6 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(true, frame.isDisplayable()); Assert.assertEquals(true, newtCanvas.isValid()); Assert.assertEquals(true, newtCanvas.isDisplayable()); - Assert.assertEquals(true, glWindow.isValid()); Assert.assertEquals(true, glWindow.isNativeValid()); Assert.assertEquals(true, windowClosingListener.isWindowClosing()); windowClosingListener.reset(); @@ -102,7 +101,6 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(false, frame.isDisplayable()); Assert.assertEquals(false, newtCanvas.isValid()); Assert.assertEquals(false, newtCanvas.isDisplayable()); - Assert.assertEquals(true, glWindow.isValid()); Assert.assertEquals(false, glWindow.isNativeValid()); Assert.assertEquals(true, windowClosingListener.isWindowClosing()); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java index 2f97e1318..f4aa44354 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java @@ -150,13 +150,13 @@ public class TestParenting01NEWT extends UITestCase { glWindow1.resetFPSCounter(); glWindow2.resetFPSCounter(); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); Assert.assertEquals(true, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); Assert.assertNotNull(animator1.getThread()); Animator animator2 = new Animator(glWindow2); - animator2.setUpdateFPSFrames(1, System.err); + animator2.setUpdateFPSFrames(1, null); animator2.start(); Assert.assertEquals(true, animator2.isAnimating()); Assert.assertEquals(false, animator2.isPaused()); @@ -212,10 +212,8 @@ public class TestParenting01NEWT extends UITestCase { glWindow2.destroy(); // can be recreated, refs are hold Assert.assertEquals(true, glWindow1.isVisible()); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(false, glWindow2.isNativeValid()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(1,display.getReferenceCount()); Assert.assertEquals(true,display.isNativeValid()); @@ -228,10 +226,8 @@ public class TestParenting01NEWT extends UITestCase { glWindow1.destroy(); // can be recreated, refs are hold Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(false, glWindow2.isNativeValid()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -266,9 +262,7 @@ public class TestParenting01NEWT extends UITestCase { // chain glwindow1 -> glwindow2 ; can be recreated .. glWindow1.destroy(); - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -278,13 +272,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - glWindow1.invalidate(); - Assert.assertEquals(false, glWindow1.isValid()); - Assert.assertEquals(false, glWindow2.isValid()); - // test double destroy/invalidate .. - glWindow2.invalidate(); - Assert.assertEquals(false, glWindow2.isValid()); + glWindow2.destroy(); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -374,10 +363,10 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); Animator animator2 = new Animator(glWindow2); - animator2.setUpdateFPSFrames(1, System.err); + animator2.setUpdateFPSFrames(1, null); animator2.start(); int state = 0; @@ -460,10 +449,8 @@ public class TestParenting01NEWT extends UITestCase { // destroy glWindow2 glWindow2.destroy(); - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(true, glWindow1.isNativeValid()); Assert.assertEquals(true, glWindow1.isVisible()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(false, glWindow2.isVisible()); @@ -478,10 +465,8 @@ public class TestParenting01NEWT extends UITestCase { // destroy glWindow1 glWindow1.destroy(); - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertEquals(false, glWindow1.isVisible()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(false, glWindow2.isVisible()); @@ -493,13 +478,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen1.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - - glWindow1.invalidate(); - Assert.assertEquals(false, glWindow1.isValid()); - Assert.assertEquals(true, glWindow2.isValid()); - - glWindow2.invalidate(); - Assert.assertEquals(false, glWindow2.isValid()); } @Test @@ -573,10 +551,10 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); Animator animator2 = new Animator(glWindow2); - animator2.setUpdateFPSFrames(1, System.err); + animator2.setUpdateFPSFrames(1, null); animator2.start(); int state = 0; @@ -638,10 +616,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); glWindow1.destroy(); // should destroy both windows, actually, since glWindow2 is a child - Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertEquals(false, glWindow1.isVisible()); - Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(false, glWindow2.isVisible()); @@ -665,9 +641,9 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); - glWindow1.invalidate(); // parent -> child - Assert.assertEquals(false, glWindow1.isValid()); - Assert.assertEquals(false, glWindow2.isValid()); + glWindow1.destroy(); // parent -> child + Assert.assertEquals(false, glWindow1.isNativeValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java index b737cf709..50461bba0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java @@ -123,7 +123,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); @@ -132,20 +132,20 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame1.setVisible(false); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.setVisible(true); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.remove(newtCanvasAWT); // Assert.assertNull(glWindow1.getParent()); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.dispose(); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); - glWindow1.invalidate(); - //Assert.assertEquals(false, glWindow1.isValid()); + glWindow1.destroy(); + Assert.assertEquals(false, glWindow1.isNativeValid()); } @Test @@ -181,7 +181,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); @@ -190,7 +190,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } @Test @@ -217,7 +217,7 @@ public class TestParenting01aAWT extends UITestCase { frame.add(newtCanvasAWT); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); Assert.assertEquals(true, animator1.isStarted()); Assert.assertEquals(true, animator1.isAnimating()); @@ -228,7 +228,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(true, animator1.isAnimating()); // !!! frame.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } @Test @@ -254,7 +254,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); int state = 0; @@ -279,7 +279,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } @Test @@ -310,7 +310,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); int state = 0; @@ -335,7 +335,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } @Test @@ -377,7 +377,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); int state = 0; @@ -401,7 +401,7 @@ public class TestParenting01aAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java index 2b8d34423..84edfc8ba 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java @@ -156,7 +156,7 @@ public class TestParenting01bAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java index 7321c6ba2..905d80925 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java @@ -125,20 +125,20 @@ public class TestParenting01cAWT extends UITestCase { } frame1.setVisible(false); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.setVisible(true); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.remove(newtCanvasAWT); // Assert.assertNull(glWindow1.getParent()); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); frame1.dispose(); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); - glWindow1.invalidate(); - //Assert.assertEquals(false, glWindow1.isValid()); + glWindow1.destroy(); + Assert.assertEquals(false, glWindow1.isNativeValid()); } @Test @@ -196,7 +196,7 @@ public class TestParenting01cAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java index f44f8a7f9..d7f3192bb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java @@ -83,7 +83,7 @@ public class TestParenting01cSwingAWT extends UITestCase { setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); final GLWindow _glWindow1 = glWindow1; @@ -152,14 +152,14 @@ public class TestParenting01cSwingAWT extends UITestCase { System.out.println("Demos: 3 - !Visible"); _jFrame1.setVisible(false); } }); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { System.out.println("Demos: 4 - Visible"); _jFrame1.setVisible(true); } }); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -167,16 +167,16 @@ public class TestParenting01cSwingAWT extends UITestCase { _jPanel1.remove(_container1); } }); // Assert.assertNull(glWindow1.getParent()); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { _jFrame1.dispose(); } }); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); - glWindow1.invalidate(); - //Assert.assertEquals(false, glWindow1.isValid()); + glWindow1.destroy(); + Assert.assertEquals(false, glWindow1.isNativeValid()); } @Test @@ -194,7 +194,7 @@ public class TestParenting01cSwingAWT extends UITestCase { setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); Animator animator1 = new Animator(glWindow1); - animator1.setUpdateFPSFrames(1, System.err); + animator1.setUpdateFPSFrames(1, null); animator1.start(); final GLWindow _glWindow1 = glWindow1; @@ -297,17 +297,17 @@ public class TestParenting01cSwingAWT extends UITestCase { _jFrame1.setVisible(false); _jFrame2.setVisible(false); } }); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); SwingUtilities.invokeAndWait(new Runnable() { public void run() { _jFrame1.dispose(); _jFrame2.dispose(); } }); - Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); - glWindow1.invalidate(); - //Assert.assertEquals(false, glWindow1.isValid()); + glWindow1.destroy(); + Assert.assertEquals(false, glWindow1.isNativeValid()); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java index 20388e295..b6e02d810 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java @@ -213,7 +213,7 @@ public class TestParenting02AWT extends UITestCase { } Thread.sleep(waitReparent); - glWindow.invalidate(); + glWindow.destroy(); if(useLayout) { frame.remove(newtCanvasAWT); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java index 9ff02346b..7c04e041b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java @@ -75,7 +75,7 @@ public class TestParenting03AWT extends UITestCase { public void testWindowParenting1AWTOneNewtChild() throws InterruptedException, InvocationTargetException { GLWindow glWindow1 = GLWindow.create(glCaps); - glWindow1.setUpdateFPSFrames(1, System.err); + glWindow1.setUpdateFPSFrames(1, null); glWindow1.setUndecorated(true); NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(size); @@ -136,7 +136,7 @@ public class TestParenting03AWT extends UITestCase { Assert.assertEquals(null, animator1.getThread()); frame1.dispose(); - glWindow1.invalidate(); + glWindow1.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java index 69af936ab..53488a44d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03bAWT.java @@ -73,7 +73,7 @@ public class TestParenting03bAWT extends UITestCase { public void testWindowParenting1AWTTwoNewtChilds() throws InterruptedException, InvocationTargetException { GLWindow glWindow1 = GLWindow.create(glCaps); - glWindow1.setUpdateFPSFrames(1, System.err); + glWindow1.setUpdateFPSFrames(1, null); glWindow1.setUndecorated(true); NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(size); @@ -104,7 +104,7 @@ public class TestParenting03bAWT extends UITestCase { animator1.start(); GLWindow glWindow2 = GLWindow.create(glCaps); - glWindow2.setUpdateFPSFrames(1, System.err); + glWindow2.setUpdateFPSFrames(1, null); glWindow2.setUndecorated(true); NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); newtCanvasAWT2.setPreferredSize(size); @@ -190,8 +190,8 @@ public class TestParenting03bAWT extends UITestCase { Assert.assertEquals(null, animator2.getThread()); frame1.dispose(); - glWindow1.invalidate(); - glWindow2.invalidate(); + glWindow1.destroy(); + glWindow2.destroy(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { |