diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
36 files changed, 246 insertions, 241 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java index e2ed5f0d0..a7534dc01 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.graph.demos; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -69,11 +70,12 @@ public class GPURegionNewtDemo01 { regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setVisible(true); //FPSAnimator animator = new FPSAnimator(60); Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.add(window); animator.start(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java index 678a40c29..9353e0c06 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.graph.demos; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -69,11 +70,12 @@ public class GPURegionNewtDemo02 { regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setVisible(true); //FPSAnimator animator = new FPSAnimator(60); Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.add(window); animator.start(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index 17e0a06d2..b173c1f06 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -31,6 +31,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAnimatorControl; @@ -228,7 +229,10 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { gl.setSwapInterval(i); final GLAnimatorControl a = drawable.getAnimator(); if( null != a ) { - a.resetCounter(); + a.resetFPSCounter(); + } + if(drawable instanceof FPSCounter) { + ((FPSCounter)drawable).resetFPSCounter(); } System.err.println("Swap Interval: "+i); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java index ff22a920e..219438146 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.graph.demos; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -61,11 +62,12 @@ public class GPUTextNewtDemo01 { GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.SINGLE_PASS, 0, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); - - window.enablePerfLog(true); + + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setVisible(true); // FPSAnimator animator = new FPSAnimator(10); Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.add(window); animator.start(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java index 067d45b73..cbe597508 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java @@ -27,6 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -72,11 +73,12 @@ public class GPUTextNewtDemo02 { // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); - - window.enablePerfLog(true); + + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setVisible(true); // FPSAnimator animator = new FPSAnimator(60); - Animator animator = new Animator(); + Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.add(window); animator.start(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index 7199226f9..119b38584 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -137,11 +137,11 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB final int width = drawable.getWidth(); final int height = drawable.getHeight(); final GLAnimatorControl animator = drawable.getAnimator(); - final boolean _drawFPS = drawFPS && null != animator && animator.getTotalFrames()>10; + final boolean _drawFPS = drawFPS && null != animator && animator.getTotalFPSFrames()>10; textRenderer.reshapeOrtho(null, width, height, 0.1f, 7000.0f); if(_drawFPS) { - final float fps = ( animator.getTotalFrames() * 1000.0f ) / (float) animator.getDuration() ; + final float fps = ( animator.getTotalFPSFrames() * 1000.0f ) / (float) animator.getTotalFPSDuration() ; final String fpsS = String.valueOf(fps); final int fpsSp = fpsS.indexOf('.'); textRenderer.resetModelview(null); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index f854d8195..c74d11f0d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -294,7 +294,7 @@ public abstract class UIListenerBase01 implements GLEventListener { gl.setSwapInterval(i); final GLAnimatorControl a = drawable.getAnimator(); if( null != a ) { - a.resetCounter(); + a.resetFPSCounter(); } System.err.println("Swap Interval: "+i); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java index e2aff5793..7d0ad83fa 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.graph.demos.ui; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -67,10 +68,11 @@ public class UINewtDemo01 { uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setVisible(true); Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.add(window); animator.start(); } 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 bf4c493bc..10c4bce42 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 @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; @@ -119,8 +120,9 @@ public class TestSharedContextListAWT extends UITestCase { GLCanvas glc2 = runTestGL(f2, animator, width, 0, true); GLCanvas glc3 = runTestGL(f3, animator, 0, height, false); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(animator.isAnimating() && animator.getDuration()<duration) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } animator.stop(); 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 f5c950646..cc565a7d0 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 @@ -29,6 +29,8 @@ package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; + +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; @@ -106,8 +108,9 @@ 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(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(animator.isAnimating() && animator.getDuration()<duration) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } animator.stop(); 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 d04ce3849..c8a89cb9b 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 @@ -29,6 +29,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.gears; import javax.media.opengl.*; + import com.jogamp.opengl.util.Animator; import javax.media.opengl.awt.GLCanvas; import com.jogamp.newt.event.awt.AWTKeyAdapter; @@ -80,9 +81,10 @@ public class TestGearsAWT extends UITestCase { new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); frame.setVisible(true); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) { + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } 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 40e2ae933..900a1d116 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 @@ -29,6 +29,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.gears; import javax.media.opengl.*; + import com.jogamp.opengl.util.FPSAnimator; import javax.media.opengl.awt.GLJPanel; @@ -83,10 +84,11 @@ public class TestGearsGLJPanelAWT extends UITestCase { _frame.setVisible(true); } } ) ; + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); Assert.assertEquals(true, animator.isAnimating()); - while(animator.isAnimating() && animator.getDuration()<duration) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } 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 c8e45ec46..07c9a89bb 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,10 +114,11 @@ public class TestGearsGLJPanelAWTBug450 extends UITestCase { _frame.setVisible(true); } } ) ; + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); Assert.assertEquals(true, animator.isAnimating()); - while(animator.isAnimating() && animator.getDuration()<duration) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } 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 0f7d77f82..a3f144c06 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 @@ -37,6 +37,8 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.Gears; + +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -98,9 +100,10 @@ public class TestGearsNEWT extends UITestCase { glWindow.setSize(width, height); glWindow.setVisible(true); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) { + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } 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 f05c20c4c..9ed324b32 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 @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.newt; import javax.media.nativewindow.*; import javax.media.opengl.*; + import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -80,9 +81,10 @@ public class TestGearsNewtAWTWrapper extends UITestCase { glWindow.setSize(width, height); glWindow.setVisible(true); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) { + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java index de6b91242..1638d69dd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java @@ -34,11 +34,15 @@ import com.jogamp.opengl.util.glsl.ShaderState; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLContext; import javax.media.opengl.GLProfile; import org.junit.Assert; public class GLSLMiscHelper { + public static final int frames_perftest = 10000; // frames + public static final int frames_warmup = 500; // frames + public static GLWindow createWindow() { GLProfile glp = GLProfile.get(GLProfile.GL2ES2); GLCapabilities caps = new GLCapabilities(glp); @@ -46,9 +50,13 @@ public class GLSLMiscHelper { window.setSize(800, 600); window.setVisible(true); Assert.assertTrue(window.isNativeValid()); - window.display(); - Assert.assertTrue(window.isRealized()); - Assert.assertTrue(window.getContext().isCreated()); + Assert.assertTrue(window.isRealized()); + GLContext context = window.getContext(); + Assert.assertNotNull(context); + context.setSynchronized(true); + context.makeCurrent(); // native context creation + context.release(); + Assert.assertTrue(context.isCreated()); return window; } @@ -72,9 +80,13 @@ public class GLSLMiscHelper { System.err.println("screen #"+num); if(preEnable) { vertices.enableBuffer(gl, true); - Assert.assertEquals(vertices.getVBOName(), gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER)); + // invalid - Assert.assertEquals(vertices.getVBOName(), gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER)); colors.enableBuffer(gl, true); - Assert.assertEquals(colors.getVBOName(), gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER)); + // invalid - Assert.assertEquals(colors.getVBOName(), gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER)); + // + // Above assertions are invalid, since GLSLArrayHandler will not bind the VBO to target + // if the VBO is already bound to the attribute itself. + // validateGLArrayDataServerState(..) does check proper VBO to attribute binding. } Assert.assertTrue(vertices.enabled()); Assert.assertTrue(colors.enabled()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index 09e6f4e8c..126e10f06 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -52,8 +52,6 @@ import org.junit.Test; */ public class TestGLSLShaderState01NEWT extends UITestCase { static long durationPerTest = 10; // ms - static int frames_perftest = 5000; // frames - static int frames_warmup = 100; // frames static final int vertices0_loc = 1; static final int colors0_loc = 2; @@ -63,7 +61,6 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // preset .. GLWindow window = GLSLMiscHelper.createWindow(); GLContext context = window.getContext(); - context.setSynchronized(true); context.makeCurrent(); GL2ES2 gl = context.getGL().getGL2ES2(); @@ -188,7 +185,6 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // preset .. GLWindow window = GLSLMiscHelper.createWindow(); GLContext context = window.getContext(); - context.setSynchronized(true); context.makeCurrent(); GL2ES2 gl = context.getGL().getGL2ES2(); @@ -245,13 +241,11 @@ public class TestGLSLShaderState01NEWT extends UITestCase { GLSLMiscHelper.displayVCArrays(window, gl, toggleEnable, vertices0, colors0, toggleEnable, 1, 0); // warmup .. - for(frames=0; frames<frames_warmup; frames++) { - GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable); + for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames++) { GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable); } // measure .. - for(frames=0; frames<frames_perftest; frames++) { - GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable); + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames++) { GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable); } final long t1 = System.currentTimeMillis(); @@ -275,7 +269,6 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // preset .. GLWindow window = GLSLMiscHelper.createWindow(); GLContext context = window.getContext(); - context.setSynchronized(true); context.makeCurrent(); GL2ES2 gl = context.getGL().getGL2ES2(); @@ -340,12 +333,12 @@ public class TestGLSLShaderState01NEWT extends UITestCase { long t0 = System.currentTimeMillis(); int frames; // warmup .. - for(frames=0; frames<frames_warmup; frames++) { + for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) { GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true); } // measure .. - for(frames=0; frames<frames_perftest; frames++) { + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=2) { GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index 7f41dbf30..57fc9a885 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -52,8 +52,6 @@ import org.junit.Test; */ public class TestGLSLShaderState02NEWT extends UITestCase { static long durationPerTest = 10; // ms - static int frames_perftest = 5000; // frames - static int frames_warmup = 100; // frames static final int vertices0_loc = 1; static final int colors0_loc = 2; @@ -63,7 +61,6 @@ public class TestGLSLShaderState02NEWT extends UITestCase { // preset .. GLWindow window = GLSLMiscHelper.createWindow(); GLContext context = window.getContext(); - context.setSynchronized(true); context.makeCurrent(); GL2ES2 gl = context.getGL().getGL2ES2(); @@ -212,7 +209,6 @@ public class TestGLSLShaderState02NEWT extends UITestCase { // preset .. GLWindow window = GLSLMiscHelper.createWindow(); GLContext context = window.getContext(); - context.setSynchronized(true); context.makeCurrent(); GL2ES2 gl = context.getGL().getGL2ES2(); @@ -287,12 +283,12 @@ public class TestGLSLShaderState02NEWT extends UITestCase { long t0 = System.currentTimeMillis(); int frames; // warmup .. - for(frames=0; frames<frames_warmup; frames++) { + for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) { GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true); } // measure .. - for(frames=0; frames<frames_perftest; frames+=2) { + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=4) { // SP0 vertices0.setLocation(-1); colors0.setLocation(-1); @@ -338,9 +334,16 @@ public class TestGLSLShaderState02NEWT extends UITestCase { } if(wait) { while(-1 == System.in.read()) ; + TestGLSLShaderState02NEWT tst = new TestGLSLShaderState02NEWT(); + try { + tst.testShaderState01PerformanceDouble(); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + String tstname = TestGLSLShaderState02NEWT.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + System.err.println("main - end"); } - String tstname = TestGLSLShaderState02NEWT.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - System.err.println("main - end"); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java index ed2f5d3cb..778f758b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java @@ -33,6 +33,7 @@ import com.jogamp.opengl.test.junit.util.GLSLSimpleProgram; import com.jogamp.opengl.test.junit.util.UITestCase; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLProfile; @@ -117,9 +118,10 @@ public class TestGLSLSimple01NEWT extends UITestCase { window.addGLEventListener(new RedSquare0()); Animator animator = new Animator(window); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); Assert.assertEquals(true, animator.isAnimating()); - while(animator.isAnimating() && animator.getDuration()<durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } Assert.assertEquals(true, animator.isAnimating()); 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 e7f376e3e..5a3c1ef0c 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 @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.glsl; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; +import javax.media.opengl.FPSCounter; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; @@ -135,9 +136,10 @@ public class TestShaderCompilationBug459AWT extends UITestCase { Animator animator = new Animator(glCanvas); frame.setVisible(true); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(animator.isAnimating() && animator.getDuration()<duration) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java index 6a02bc03b..40ea6848a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java @@ -92,7 +92,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { WindowUtilNEWT.setDemoFields(demo, window, glWindow, false); glWindow.addGLEventListener(demo); - while ( glWindow.getTotalFrames() < 2) { + while ( glWindow.getTotalFPSFrames() < 2) { glWindow.display(); } @@ -187,7 +187,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { glWindows[i].addGLEventListener(demos[i]); } - while ( glWindows[0].getTotalFrames() < 2) { + while ( glWindows[0].getTotalFPSFrames() < 2) { for(i=0; i<winnum; i++) { glWindows[i].display(); } @@ -240,7 +240,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { glWindows[i].addGLEventListener(demos[i]); } - while ( glWindows[0].getTotalFrames() < 2) { + while ( glWindows[0].getTotalFPSFrames() < 2) { for(i=0; i<winnum; i++) { glWindows[i].display(); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java index d92b4ffbf..cc6e9b26d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java @@ -101,7 +101,7 @@ public class TestOffscreen02BitmapNEWT extends UITestCase { WindowUtilNEWT.setDemoFields(demo, window, glWindow, false); glWindow.addGLEventListener(demo); - while ( glWindow.getTotalFrames() < 2) { + while ( glWindow.getTotalFPSFrames() < 2) { glWindow.display(); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java index 4420a5107..199b094f2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java @@ -100,7 +100,7 @@ public class WindowUtilNEWT { System.err.println("+++++++++++++++++++++++++++"); } - while ( windowOffScreen.getTotalFrames() < frames) { + while ( windowOffScreen.getTotalFPSFrames() < frames) { windowOffScreen.display(); } windowOffScreen.removeAllSurfaceUpdatedListener(); 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 9343e2dd8..c5e7582d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -118,7 +118,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); // lazy native creation sequence: Display, Screen and Window - Assert.assertEquals(0, window.getTotalFrames()); + Assert.assertEquals(0, window.getTotalFPSFrames()); window.setVisible(true); Assert.assertEquals(screen,window.getScreen()); @@ -130,14 +130,14 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<1*durationPerTest) { + while(window.getTotalFPSDuration()<1*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // just make the Window invisible window.setVisible(false); @@ -145,19 +145,19 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); // just make the Window visible again - window.resetCounter(); - Assert.assertEquals(0, window.getTotalFrames()); + window.resetFPSCounter(); + Assert.assertEquals(0, window.getTotalFPSFrames()); window.setVisible(true); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<2*durationPerTest) { + while(window.getTotalFPSDuration()<2*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // destruction .. window.destroy(); @@ -172,12 +172,12 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true, window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); - window.resetCounter(); - Assert.assertEquals(0, window.getTotalFrames()); + window.resetFPSCounter(); + Assert.assertEquals(0, window.getTotalFPSFrames()); // a display call shall not change a thing window.display(); - Assert.assertEquals(0, window.getTotalFrames()); + Assert.assertEquals(0, window.getTotalFPSFrames()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -193,14 +193,14 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 2: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<1*durationPerTest) { + while(window.getTotalFPSDuration()<1*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // destruction .. window.destroy(); 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 d17c5f025..3691941ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -106,7 +106,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); // lazy native creation sequence: Display, Screen and Window - Assert.assertEquals(0, window.getTotalFrames()); + Assert.assertEquals(0, window.getTotalFPSFrames()); window.setVisible(true); Assert.assertEquals(screen,window.getScreen()); @@ -119,14 +119,14 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<1*durationPerTest) { + while(window.getTotalFPSDuration()<1*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // just make the Window invisible window.setVisible(false); @@ -134,19 +134,19 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); // just make the Window visible again - window.resetCounter(); - Assert.assertEquals(0, window.getTotalFrames()); + window.resetFPSCounter(); + Assert.assertEquals(0, window.getTotalFPSFrames()); window.setVisible(true); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<2*durationPerTest) { + while(window.getTotalFPSDuration()<2*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // destruction.. ref count down, but keep all window.destroy(); @@ -164,12 +164,12 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); - window.resetCounter(); - Assert.assertEquals(0, window.getTotalFrames()); + window.resetFPSCounter(); + Assert.assertEquals(0, window.getTotalFPSFrames()); // a display call shall not change a thing window.display(); - Assert.assertEquals(0, window.getTotalFrames()); + Assert.assertEquals(0, window.getTotalFPSFrames()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -187,14 +187,14 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); + System.err.println("Frames for setVisible(true) 2: "+window.getTotalFPSFrames()); + Assert.assertTrue(0 < window.getTotalFPSFrames()); - while(window.getDuration()<1*durationPerTest) { + while(window.getTotalFPSDuration()<1*durationPerTest) { window.display(); Thread.sleep(100); } - System.err.println("duration: "+window.getDuration()); + System.err.println("duration: "+window.getTotalFPSDuration()); // destruction + invalidate, ie Display/Screen will be unreferenced window.invalidate(); @@ -255,7 +255,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(false,window2.isVisible()); // lazy native creation sequence: Display, Screen and Window - Assert.assertEquals(0, window1.getTotalFrames()); + Assert.assertEquals(0, window1.getTotalFPSFrames()); window1.setVisible(true); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -267,10 +267,10 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFrames()); - Assert.assertTrue(0 < window1.getTotalFrames()); + System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFPSFrames()); + Assert.assertTrue(0 < window1.getTotalFPSFrames()); - Assert.assertEquals(0, window2.getTotalFrames()); + Assert.assertEquals(0, window2.getTotalFPSFrames()); window2.setVisible(true); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -282,14 +282,14 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window2.isNativeValid()); Assert.assertEquals(true,window2.isVisible()); - System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFrames()); - Assert.assertTrue(0 < window2.getTotalFrames()); + System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFPSFrames()); + Assert.assertTrue(0 < window2.getTotalFPSFrames()); - while(window1.getDuration()<1*durationPerTest) { + while(window1.getTotalFPSDuration()<1*durationPerTest) { window1.display(); Thread.sleep(100); } - System.err.println("duration: "+window1.getDuration()); + System.err.println("duration: "+window1.getTotalFPSDuration()); // just make the Window invisible window1.setVisible(false); 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 047df5cf7..31170d32d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java @@ -133,10 +133,10 @@ public class TestFocus01SwingAWTRobot extends UITestCase { Assert.assertTrue(AWTRobotUtil.toFront(robot, frame1)); int wait=0; - while(wait<awtWaitTimeout/100 && glWindow1.getTotalFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; } - System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames()); + while(wait<awtWaitTimeout/100 && glWindow1.getTotalFPSFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; } + System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFPSFrames()); Assert.assertTrue(glWindow1.isVisible()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); // Continuous animation .. Animator animator = new Animator(glWindow1); 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 15e4c3ad8..8242ebb32 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -164,10 +164,10 @@ public class TestFocus02SwingAWTRobot extends UITestCase { Assert.assertTrue(AWTRobotUtil.toFront(robot, jFrame1)); int wait=0; - while(wait<awtWaitTimeout/100 && glWindow1.getTotalFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; } - System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames()); + while(wait<awtWaitTimeout/100 && glWindow1.getTotalFPSFrames()<1) { Thread.sleep(awtWaitTimeout/10); wait++; } + System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFPSFrames()); Assert.assertTrue(glWindow1.isVisible()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); // Continuous animation .. Animator animator1 = new Animator(glWindow1); 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 5be97714d..2d0007ecb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java @@ -91,12 +91,12 @@ public class TestGLWindows01NEWT extends UITestCase { glWindow.setSize(width, height); - Assert.assertEquals(0, glWindow.getTotalFrames()); + Assert.assertEquals(0, glWindow.getTotalFPSFrames()); glWindow.setVisible(true); Assert.assertEquals(true,glWindow.isVisible()); Assert.assertEquals(true,glWindow.isNativeValid()); - System.out.println("Frames for initial setVisible(true): "+glWindow.getTotalFrames()); - Assert.assertTrue(0 < glWindow.getTotalFrames()); + System.out.println("Frames for initial setVisible(true): "+glWindow.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow.getTotalFPSFrames()); // // Create native OpenGL resources .. XGL/WGL/CGL .. @@ -195,7 +195,7 @@ public class TestGLWindows01NEWT extends UITestCase { for(state=0; state*100<durationPerTest; state++) { Thread.sleep(100); } - System.out.println("duration: "+window.getDuration()); + System.out.println("duration: "+window.getTotalFPSDuration()); destroyWindow(window); } @@ -211,7 +211,7 @@ public class TestGLWindows01NEWT extends UITestCase { for(state=0; state*100<durationPerTest; state++) { Thread.sleep(100); } - System.out.println("duration: "+window.getDuration()); + System.out.println("duration: "+window.getTotalFPSDuration()); destroyWindow(window); } @@ -226,7 +226,7 @@ public class TestGLWindows01NEWT extends UITestCase { for(state=0; state*100<durationPerTest; state++) { Thread.sleep(100); } - System.out.println("duration: "+window.getDuration()); + System.out.println("duration: "+window.getTotalFPSDuration()); destroyWindow(window); } @@ -263,8 +263,8 @@ public class TestGLWindows01NEWT extends UITestCase { for(state=0; state*100<durationPerTest; state++) { Thread.sleep(100); } - System.out.println("duration1: "+window1.getDuration()); - System.out.println("duration2: "+window2.getDuration()); + System.out.println("duration1: "+window1.getTotalFPSDuration()); + System.out.println("duration2: "+window2.getTotalFPSDuration()); destroyWindow(window1); destroyWindow(window2); @@ -325,8 +325,8 @@ public class TestGLWindows01NEWT extends UITestCase { for(state=0; state*100<durationPerTest; state++) { Thread.sleep(100); } - System.out.println("duration1: "+window1.getDuration()); - System.out.println("duration2: "+window2.getDuration()); + System.out.println("duration1: "+window1.getTotalFPSDuration()); + System.out.println("duration2: "+window2.getTotalFPSDuration()); // It is observed that some X11 drivers, eg ATI, fglrx 8.78.6, // are quite sensitive to multiple Display connections (NEWT Display -> X11 Display). 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 6582a96c0..f7aab9efa 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -118,8 +118,9 @@ 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(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); Assert.assertTrue(animator.start()); - while(animator.isAnimating() && animator.getDuration()<durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } destroyWindow(window); @@ -133,8 +134,9 @@ 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(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); Assert.assertTrue(animator.start()); - while(animator.isAnimating() && animator.getDuration()<durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } destroyWindow(window); @@ -162,6 +164,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { window2.setPosition(screen.getWidth()-width, 0); Animator animator = new Animator(); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -181,7 +184,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); - while(animator.isAnimating() && animator.getDuration()<durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } window1.invalidate(); @@ -189,7 +192,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); - while(animator.isAnimating() && animator.getDuration()<2*durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<2*durationPerTest) { Thread.sleep(100); } window2.invalidate(); @@ -242,7 +245,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); - while(animator.isAnimating() && animator.getDuration()<durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } destroyWindow(window1); @@ -250,7 +253,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); - while(animator.isAnimating() && animator.getDuration()<2*durationPerTest) { + while(animator.isAnimating() && animator.getTotalFPSDuration()<2*durationPerTest) { Thread.sleep(100); } destroyWindow(window2); 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 b2068d976..41f0563ac 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java @@ -109,8 +109,9 @@ public class TestListenerCom01AWT extends UITestCase { frame.setVisible(true); Animator animator1 = new Animator(glWindow); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); width+=10; height+=10; frame.setSize(width, height); 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 6b501e31d..57e69afc8 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -34,6 +34,7 @@ import org.junit.BeforeClass; import org.junit.Test; import javax.media.opengl.*; + import com.jogamp.opengl.util.Animator; import com.jogamp.newt.*; @@ -136,9 +137,10 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window2.isVisible()); animator.add(window2); + animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator.start(); - while(animator.getDuration()<durationPerTest) { + while(animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } 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 5173d0f22..d1c82ba34 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 @@ -62,15 +62,10 @@ public class TestParenting01NEWT extends UITestCase { @Test public void testWindowParenting01CreateVisibleDestroy() throws InterruptedException { - int x = 0; - int y = 0; - Assert.assertEquals(0,Display.getActiveDisplayNumber()); Display display = null; Screen screen = null; - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); @@ -113,12 +108,12 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // visible test - Assert.assertEquals(0, glWindow1.getTotalFrames()); - Assert.assertEquals(0, glWindow2.getTotalFrames()); + Assert.assertEquals(0, glWindow1.getTotalFPSFrames()); + Assert.assertEquals(0, glWindow2.getTotalFPSFrames()); glWindow1.setVisible(true); - System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(true, glWindow1.isVisible()); Assert.assertEquals(true, glWindow1.isNativeValid()); @@ -138,38 +133,40 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - glWindow1.resetCounter(); - glWindow2.resetCounter(); - Assert.assertEquals(0, glWindow1.getTotalFrames()); - Assert.assertEquals(0, glWindow2.getTotalFrames()); + glWindow1.resetFPSCounter(); + glWindow2.resetFPSCounter(); + Assert.assertEquals(0, glWindow1.getTotalFPSFrames()); + Assert.assertEquals(0, glWindow2.getTotalFPSFrames()); glWindow1.setVisible(true); - System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFrames()+", B2: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFPSFrames()+", B2: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(true, glWindow1.isVisible()); Assert.assertEquals(true, glWindow1.isNativeValid()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - glWindow1.resetCounter(); - glWindow2.resetCounter(); + glWindow1.resetFPSCounter(); + glWindow2.resetFPSCounter(); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); Assert.assertEquals(true, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); Assert.assertNotNull(animator1.getThread()); Animator animator2 = new Animator(glWindow2); + animator2.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator2.start(); Assert.assertEquals(true, animator2.isAnimating()); Assert.assertEquals(false, animator2.isPaused()); Assert.assertNotNull(animator2.getThread()); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } - System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(true, animator1.pause()); Assert.assertEquals(false, animator1.isAnimating()); @@ -180,8 +177,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, animator2.isPaused()); Assert.assertNotNull(animator2.getThread()); - glWindow1.resetCounter(); - glWindow2.resetCounter(); + glWindow1.resetFPSCounter(); + glWindow2.resetFPSCounter(); Assert.assertEquals(true, animator1.resume()); Assert.assertEquals(true, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); @@ -191,9 +188,9 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false, animator2.isPaused()); Assert.assertNotNull(animator2.getThread()); Thread.sleep(waitAbout10FramesAt30fps); - System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFrames()+", B4: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFPSFrames()+", B4: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); animator1.stop(); Assert.assertEquals(false, animator1.isAnimating()); @@ -245,19 +242,19 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // recreation .. - glWindow1.resetCounter(); - glWindow2.resetCounter(); - Assert.assertEquals(0, glWindow1.getTotalFrames()); - Assert.assertEquals(0, glWindow2.getTotalFrames()); + glWindow1.resetFPSCounter(); + glWindow2.resetFPSCounter(); + Assert.assertEquals(0, glWindow1.getTotalFPSFrames()); + Assert.assertEquals(0, glWindow2.getTotalFPSFrames()); glWindow1.setVisible(true); Assert.assertEquals(true, glWindow1.isVisible()); Assert.assertEquals(true, glWindow1.isNativeValid()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(1,display.getReferenceCount()); Assert.assertEquals(true,display.isNativeValid()); @@ -312,15 +309,10 @@ public class TestParenting01NEWT extends UITestCase { * @param reparentRecreate true, if the followup reparent should utilize destroy/create, instead of native reparenting */ protected void testWindowParenting02ReparentTop2WinImpl(boolean reparentRecreate) throws InterruptedException { - int x = 0; - int y = 0; - Assert.assertEquals(0,Display.getActiveDisplayNumber()); Display display1 = null; Screen screen1 = null; - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setTitle("testWindowParenting02ReparentTop2Win"); glWindow1.setSize(640, 480); @@ -354,7 +346,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen1.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - Assert.assertEquals(0, glWindow1.getTotalFrames()); + Assert.assertEquals(0, glWindow1.getTotalFPSFrames()); glWindow1.setVisible(true); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -364,10 +356,10 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,screen1.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(true, glWindow1.isVisible()); - System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); + System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); - Assert.assertEquals(0, glWindow2.getTotalFrames()); + Assert.assertEquals(0, glWindow2.getTotalFPSFrames()); glWindow2.setVisible(true); Assert.assertEquals(1,display1.getReferenceCount()); @@ -378,31 +370,33 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,screen1.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(true, glWindow2.isVisible()); - System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); + System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); Animator animator2 = new Animator(glWindow2); + animator2.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator2.start(); int state = 0; int reparentAction; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: // glWindow2 -- child --> glWindow1: compatible Assert.assertEquals(true, glWindow2.isVisible()); - System.err.println("Frames(1) "+glWindow2.getTotalFrames()); + System.err.println("Frames(1) "+glWindow2.getTotalFPSFrames()); reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate); - System.err.println("Frames(2) "+glWindow2.getTotalFrames()); + System.err.println("Frames(2) "+glWindow2.getTotalFPSFrames()); Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); Assert.assertSame(glWindow1,glWindow2.getParent()); - System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -425,8 +419,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); Assert.assertNull(glWindow2.getParent()); - System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -519,11 +513,6 @@ public class TestParenting01NEWT extends UITestCase { } protected void testWindowParenting03ReparentWin2TopImpl(boolean reparentRecreate) throws InterruptedException { - int x = 0; - int y = 0; - - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - Assert.assertEquals(0,Display.getActiveDisplayNumber()); Display display1 = null; Screen screen1 = null; @@ -566,12 +555,12 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); - Assert.assertEquals(0, glWindow1.getTotalFrames()); - Assert.assertEquals(0, glWindow2.getTotalFrames()); + Assert.assertEquals(0, glWindow1.getTotalFPSFrames()); + Assert.assertEquals(0, glWindow2.getTotalFPSFrames()); glWindow1.setVisible(true); - System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); + System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -584,13 +573,15 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); Animator animator2 = new Animator(glWindow2); + animator2.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator2.start(); int state = 0; int reparentAction; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: @@ -599,8 +590,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertNull(glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); @@ -612,8 +603,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFPSFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFPSFrames()); Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); 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 424fff0e2..3046eb061 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,8 +123,9 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } animator1.stop(); @@ -180,8 +181,9 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } animator1.stop(); @@ -215,10 +217,11 @@ public class TestParenting01aAWT extends UITestCase { frame.add(newtCanvasAWT); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); Assert.assertEquals(true, animator1.isStarted()); Assert.assertEquals(true, animator1.isAnimating()); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } @@ -251,10 +254,11 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); int state = 0; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: @@ -306,10 +310,11 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); int state = 0; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: @@ -372,10 +377,11 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); int state = 0; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: 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 dde125330..80b7647ae 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 @@ -70,11 +70,6 @@ public class TestParenting01cSwingAWT extends UITestCase { @Test public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException { - int x = 0; - int y = 0; - - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - /** * JFrame . JPanel . Container . NewtCanvasAWT . GLWindow */ @@ -88,7 +83,9 @@ public class TestParenting01cSwingAWT extends UITestCase { setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); + final GLWindow _glWindow1 = glWindow1; final GLRunnable _glRunnable = new GLRunnableDummy(); Thread disturbanceThread = new Thread(new Runnable() { @@ -143,7 +140,7 @@ public class TestParenting01cSwingAWT extends UITestCase { // visible test Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); - while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } System.out.println("Demos: 2 - StopAnimator"); @@ -184,11 +181,6 @@ public class TestParenting01cSwingAWT extends UITestCase { @Test public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException { - int x = 0; - int y = 0; - - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - /** * JFrame . JPanel . Container . NewtCanvasAWT . GLWindow */ @@ -202,7 +194,9 @@ public class TestParenting01cSwingAWT extends UITestCase { setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); Animator animator1 = new Animator(glWindow1); + animator1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); animator1.start(); + final GLWindow _glWindow1 = glWindow1; final GLRunnable _glRunnable = new GLRunnableDummy(); Thread disturbanceThread = new Thread(new Runnable() { @@ -266,7 +260,6 @@ public class TestParenting01cSwingAWT extends UITestCase { final NewtCanvasAWT _newtCanvasAWT = newtCanvasAWT; final JFrame _jFrame1 = jFrame1; - final JPanel _jPanel1 = jPanel1; final Container _container1 = container1; final JFrame _jFrame2 = jFrame2; final JPanel _jPanel2 = jPanel2; @@ -275,7 +268,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); int state = 0; - while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { + while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); switch(state) { case 0: 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 7da30cf18..adfdc68f7 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 @@ -29,30 +29,20 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.lang.reflect.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.junit.Assert; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.After; -import org.junit.AfterClass; import org.junit.Test; -import java.awt.Button; import java.awt.BorderLayout; -import java.awt.Canvas; import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.Label; import javax.media.opengl.*; -import javax.media.nativewindow.*; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.FPSAnimator; import com.jogamp.newt.*; import com.jogamp.newt.event.*; import com.jogamp.newt.opengl.*; @@ -84,13 +74,8 @@ public class TestParenting03AWT extends UITestCase { } public void testWindowParenting1AWTOneNewtChild() throws InterruptedException, InvocationTargetException { - int x = 0; - int y = 0; - - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - GLWindow glWindow1 = GLWindow.create(glCaps); - glWindow1.enablePerfLog(true); + glWindow1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow1.setUndecorated(true); NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(size); @@ -124,7 +109,6 @@ public class TestParenting03AWT extends UITestCase { cont1.setLayout(new BorderLayout()); cont1.add(newtCanvasAWT1, BorderLayout.CENTER); cont1.setVisible(true); - final Container f_cont1 = cont1; Frame frame1 = new Frame("AWT Parent Frame"); frame1.setLayout(new BorderLayout()); 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 34d95d8ee..9aec5d80d 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 @@ -29,30 +29,20 @@ package com.jogamp.opengl.test.junit.newt.parenting; import java.lang.reflect.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.junit.Assert; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.After; -import org.junit.AfterClass; import org.junit.Test; -import java.awt.Button; import java.awt.BorderLayout; -import java.awt.Canvas; import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.Label; import javax.media.opengl.*; -import javax.media.nativewindow.*; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.FPSAnimator; import com.jogamp.newt.*; import com.jogamp.newt.event.*; import com.jogamp.newt.opengl.*; @@ -82,13 +72,8 @@ public class TestParenting03bAWT extends UITestCase { } public void testWindowParenting1AWTTwoNewtChilds() throws InterruptedException, InvocationTargetException { - int x = 0; - int y = 0; - - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - GLWindow glWindow1 = GLWindow.create(glCaps); - glWindow1.enablePerfLog(true); + glWindow1.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow1.setUndecorated(true); NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(size); @@ -119,7 +104,7 @@ public class TestParenting03bAWT extends UITestCase { animator1.start(); GLWindow glWindow2 = GLWindow.create(glCaps); - glWindow2.enablePerfLog(true); + glWindow2.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow2.setUndecorated(true); NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); newtCanvasAWT2.setPreferredSize(size); @@ -153,7 +138,6 @@ public class TestParenting03bAWT extends UITestCase { cont1.setLayout(new BorderLayout()); cont1.add(newtCanvasAWT1, BorderLayout.CENTER); cont1.setVisible(true); - final Container f_cont1 = cont1; Container cont2 = new Container(); cont2.setLayout(new BorderLayout()); |