aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java13
2 files changed, 38 insertions, 7 deletions
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<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -123,11 +134,30 @@ public class TestGearsES2AWT extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
} else if(args[i].equals("-es2")) {
forceES2 = true;
+ } else if(args[i].equals("-vsync")) {
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
+ } else if(args[i].equals("-layered")) {
+ shallUseOffscreenLayer = true;
+ } else if(args[i].equals("-showFPS")) {
+ showFPS = true;
} else if(args[i].equals("-firstUIAction")) {
firstUIActionOnProcess = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
}
}
System.err.println("forceES2 "+forceES2);
+ System.err.println("swapInterval "+swapInterval);
+ System.err.println("shallUseOffscreenLayer "+shallUseOffscreenLayer);
+
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
org.junit.runner.JUnitCore.main(TestGearsES2AWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index cab46b475..264b62fec 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -77,7 +77,7 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean alwaysOnTop = false;
static boolean fullscreen = false;
static boolean pmvUseBackingArray = true;
- static boolean vsync = false;
+ static int swapInterval = 1;
static boolean waitForKey = false;
static boolean mouseVisible = true;
static boolean mouseConfined = false;
@@ -98,12 +98,12 @@ public class TestGearsES2NEWT extends UITestCase {
}
protected void runTestGL(GLCapabilitiesImmutable caps, boolean undecorated) throws InterruptedException {
- System.err.println("requested: vsync "+vsync+", "+caps);
+ System.err.println("requested: vsync "+swapInterval+", "+caps);
Display dpy = NewtFactory.createDisplay(null);
Screen screen = NewtFactory.createScreen(dpy, screenIdx);
final GLWindow glWindow = GLWindow.create(screen, caps);
Assert.assertNotNull(glWindow);
- glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), vsync "+vsync+", size "+wsize+", pos "+wpos);
+ glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval+", size "+wsize+", pos "+wpos);
glWindow.setSize(wsize.getWidth(), wsize.getHeight());
if(null != wpos) {
glWindow.setPosition(wpos.getX(), wpos.getY());
@@ -114,7 +114,7 @@ public class TestGearsES2NEWT extends UITestCase {
glWindow.setPointerVisible(mouseVisible);
glWindow.confinePointer(mouseConfined);
- final GearsES2 demo = new GearsES2(vsync ? 1 : -1);
+ final GearsES2 demo = new GearsES2(swapInterval);
demo.setPMVUseBackingArray(pmvUseBackingArray);
glWindow.addGLEventListener(demo);
if(waitForKey) {
@@ -276,7 +276,8 @@ public class TestGearsES2NEWT extends UITestCase {
} else if(args[i].equals("-pmvDirect")) {
pmvUseBackingArray = false;
} else if(args[i].equals("-vsync")) {
- vsync = true;
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
} else if(args[i].equals("-es2")) {
forceES2 = true;
} else if(args[i].equals("-wait")) {
@@ -332,7 +333,7 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("atop "+alwaysOnTop);
System.err.println("fullscreen "+fullscreen);
System.err.println("pmvDirect "+(!pmvUseBackingArray));
- System.err.println("vsync "+vsync);
+ System.err.println("swapInterval "+swapInterval);
System.err.println("mouseVisible "+mouseVisible);
System.err.println("mouseConfined "+mouseConfined);
System.err.println("loops "+loops);