From 9d522e77a9ac1f85c57236f00d5432e671f9169c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 22 Apr 2012 05:12:16 +0200 Subject: Completing swap-interval implementation for OSX's CALayer usage. Closing Bug 555 - Based on Andres Colubri's initiative and commit 218d67fc0222d7709b21c45792d44501351939c4. - Reading real screen refresh rate ('stolen' from NEWT) - Properly handling swap-interval and vsync-to in native code - Increasing accuracy vsync-to to microseconds Tested manually w/ TestGearsES2AWT. --- .../junit/jogl/demos/es2/awt/TestGearsES2AWT.java | 32 +++++++++++++++++++++- .../jogl/demos/es2/newt/TestGearsES2NEWT.java | 13 +++++---- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'src/test/com/jogamp') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index 5bf341388..c6e224548 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -38,9 +38,13 @@ import com.jogamp.newt.event.TraceKeyAdapter; import com.jogamp.newt.event.TraceWindowAdapter; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import java.awt.Frame; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import org.junit.Assert; @@ -52,6 +56,9 @@ public class TestGearsES2AWT extends UITestCase { static int width, height; static boolean firstUIActionOnProcess = false; static boolean forceES2 = false; + static boolean shallUseOffscreenLayer = false; + static int swapInterval = 1; + static boolean showFPS = false; @BeforeClass public static void initClass() { @@ -69,10 +76,12 @@ public class TestGearsES2AWT extends UITestCase { final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); + glCanvas.setShallUseOffscreenLayer(shallUseOffscreenLayer); frame.add(glCanvas); frame.setSize(512, 512); + frame.setTitle("Gears AWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval); - glCanvas.addGLEventListener(new GearsES2(1)); + glCanvas.addGLEventListener(new GearsES2(swapInterval)); Animator animator = new Animator(glCanvas); QuitAdapter quitAdapter = new QuitAdapter(); @@ -115,6 +124,8 @@ public class TestGearsES2AWT extends UITestCase { static long duration = 500; // ms public static void main(String args[]) { + boolean waitForKey = false; + for(int i=0; i