aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java235
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java24
9 files changed, 345 insertions, 22 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
new file mode 100644
index 000000000..656cb47bd
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
@@ -0,0 +1,235 @@
+/**
+ * Copyright 2015 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Window;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Locale;
+
+import javax.swing.AbstractButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.DumpGLInfo;
+import com.jogamp.opengl.test.junit.util.GLClearColor;
+import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
+ static final int NB_TEST = 5;
+ static final int ACTION_DELAY = 500;
+ static final int MOVE_DELAY = 2;
+ static final int MOVE_ITER = 100;
+ static final int TOOLTIP_WAIT = 3*1000; // 5s
+
+ static AbstractButton findButton(final int depth, final Container c, final String buttonText) {
+ AbstractButton res = null;
+ final int cc = c.getComponentCount();
+ for(int i=0; null==res && i<cc; i++) {
+ final Component e = c.getComponent(i);
+ // System.err.println("["+depth+"]["+i+"]: "+e.getClass().getSimpleName()+": "+e);
+ if( e instanceof AbstractButton ) {
+ final AbstractButton b = (AbstractButton) e;
+ final String bT = b.getText();
+ if( buttonText.equals(bT) ) {
+ res = b;
+ }
+ } else if( e instanceof Container ) {
+ res = findButton(depth+1, (Container)e, buttonText);
+ }
+ }
+ return res;
+ }
+
+ private void oneTest(final GLCapabilitiesImmutable caps) {
+ // base dialog
+ final JDialog dialog = new JDialog((Window) null);
+ dialog.setMinimumSize(new Dimension(500, 300));
+ dialog.setPreferredSize(new Dimension(500, 300));
+
+ dialog.setModal(false);
+
+ // build accessory
+ final GLEventListenerCounter glelc1 = new GLEventListenerCounter();
+ final GLCanvas canvas1 = new GLCanvas(caps);
+ canvas1.addGLEventListener(new DumpGLInfo(Platform.getNewline()+Platform.getNewline()+"Pre-ToolTip", false, false, false));
+ canvas1.addGLEventListener(new GLClearColor(1f, 0f, 0f, 1f));
+ canvas1.addGLEventListener(glelc1);
+ final JPanel panel1 = new JPanel(new BorderLayout());
+ panel1.add(canvas1, BorderLayout.CENTER);
+ panel1.setPreferredSize(new Dimension(300, 300));
+
+ final GLEventListenerCounter glelc2 = new GLEventListenerCounter();
+ final GLCanvas canvas2 = new GLCanvas(caps);
+ canvas2.addGLEventListener(new DumpGLInfo(Platform.getNewline()+Platform.getNewline()+"Post-ToolTip", false, false, false));
+ canvas2.addGLEventListener(new GLClearColor(0f, 0f, 1f, 1f));
+ canvas2.addGLEventListener(glelc2);
+ final JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(canvas2, BorderLayout.CENTER);
+ panel2.setPreferredSize(new Dimension(300, 300));
+
+ // create file chooser with accessory
+ final JFileChooser fileChooser = new JFileChooser();
+ final String approveButtonText = "Approved";
+ fileChooser.setApproveButtonText(approveButtonText);
+ fileChooser.setApproveButtonToolTipText("Tool-Tip for Approved");
+ fileChooser.setAccessory(panel1);
+
+ final Locale l = fileChooser.getLocale();
+ final String cancelButtonText = UIManager.getString("FileChooser.cancelButtonText",l);
+
+ // launch robot action ..
+ new Thread()
+ {
+ public void run()
+ {
+ try {
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(fileChooser, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
+
+ final Point approveButtonPos;
+ final AbstractButton approveButton = findButton(0, fileChooser, approveButtonText);
+ if( null != approveButton ) {
+ approveButtonPos = approveButton.getLocationOnScreen();
+ approveButtonPos.translate(2, 2);
+ System.err.println("OK Button: "+approveButton.getClass().getSimpleName()+"; "+approveButton+", "+approveButtonPos);
+ } else {
+ System.err.println("OK Button: NULL");
+ approveButtonPos = null;
+ }
+ final Point cancelButtonPos;
+ final AbstractButton cancelButton = findButton(0, fileChooser, cancelButtonText);
+ if( null != approveButton ) {
+ cancelButtonPos = cancelButton.getLocationOnScreen();
+ cancelButtonPos.translate(2, 2);
+ System.err.println("CANCEL Button: "+cancelButton.getClass().getSimpleName()+"; "+cancelButton+", "+cancelButtonPos);
+ } else {
+ cancelButtonPos = null;
+ System.err.println("CANCEL Button: NULL");
+ }
+ final Robot robot = new Robot();
+ // hover to 'approve' -> tool tip
+ if( null != approveButtonPos ) {
+ AWTRobotUtil.mouseMove(robot, approveButtonPos, MOVE_ITER, MOVE_DELAY);
+ Thread.sleep(TOOLTIP_WAIT);
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ fileChooser.setAccessory(panel2);
+ fileChooser.validate();
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
+ }
+ if( null != cancelButtonPos ) {
+ AWTRobotUtil.mouseClick(robot, cancelButtonPos, MOVE_ITER, MOVE_DELAY, ACTION_DELAY);
+ } else {
+ // oops ..
+ fileChooser.cancelSelection();
+ }
+ } catch (final AWTException e1) {
+ e1.printStackTrace();
+ } catch (final InterruptedException e2) {
+ e2.printStackTrace();
+ }
+ }
+ }.start();
+
+ // show file chooser dialog
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ dialog.setVisible(true);
+ fileChooser.showOpenDialog(dialog);
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ // dispose of resources
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ canvas1.destroy();
+ canvas2.destroy();
+ dialog.setVisible(false);
+ dialog.dispose();
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ Assert.assertEquals(1, glelc1.initCount);
+ Assert.assertEquals(1, glelc2.initCount);
+ }
+
+ @Test
+ public void test01() {
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ for (int i = 0; i < NB_TEST; i++) {
+ System.out.println("Iteration " + i + " / " + NB_TEST);
+ oneTest(caps);
+ }
+ }
+
+ public static void main(final String[] pArgs)
+ {
+ org.junit.runner.JUnitCore.main(TestBug1146GLContextDialogToolTipAWT.class.getName());
+ }
+} \ No newline at end of file
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
index 395f6661d..7b8fa077a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
@@ -56,12 +56,12 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
static final VersionNumberString curVersionNumber = new VersionNumberString(curVersion.getImplementationVersion());
static final Set<String> excludesDefault;
- static final Set<String> excludesV230V23X;
+ static final Set<String> excludesStereoPackage;
static {
excludesDefault = new HashSet<String>();
excludesDefault.add("^\\Qjogamp/\\E.*$");
- excludesV230V23X = new HashSet<String>(excludesDefault);
- excludesV230V23X.add("^\\Qcom/jogamp/opengl/util/stereo/\\E.*$");
+ excludesStereoPackage = new HashSet<String>(excludesDefault);
+ excludesStereoPackage.add("^\\Qcom/jogamp/opengl/util/stereo/\\E.*$");
}
@@ -138,7 +138,7 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType,
previousJar, preVersionNumber,
curVersion.getClass(), currentCL, curVersionNumber,
- excludesV230V23X);
+ excludesStereoPackage);
}
public static void main(final String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index e95c2a9da..f70df89dc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -43,7 +43,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoGLEventListener;
import java.nio.FloatBuffer;
@@ -407,9 +407,11 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
private final float[] vec3Tmp2 = new float[3];
private final float[] vec3Tmp3 = new float[3];
+ private static final float[] vec3ScalePos = new float[] { 20f, 20f, 20f };
+
@Override
public void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height,
- final EyeParameter eyeParam, final EyePose eyePose) {
+ final EyeParameter eyeParam, final ViewerPose viewerPose) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
final float[] mat4Projection = FloatUtil.makePerspective(mat4Tmp1, 0, true, eyeParam.fovhv, zNear, zFar);
@@ -426,10 +428,12 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
final Quaternion rollPitchYaw = new Quaternion();
// private final float eyeYaw = FloatUtil.PI; // 180 degrees in radians
// rollPitchYaw.rotateByAngleY(eyeYaw);
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, eyePose.position, 0);
+ // final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ final float[] shiftedEyePos = VectorUtil.copyVec3(vec3Tmp1, 0, viewerPose.position, 0);
+ VectorUtil.scaleVec3(shiftedEyePos, shiftedEyePos, vec3ScalePos); // amplify viewerPose position
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);
- rollPitchYaw.mult(eyePose.orientation);
+ rollPitchYaw.mult(viewerPose.orientation);
final float[] up = rollPitchYaw.rotateVector(vec3Tmp2, 0, VectorUtil.VEC3_UNIT_Y, 0);
final float[] forward = rollPitchYaw.rotateVector(vec3Tmp3, 0, VectorUtil.VEC3_UNIT_Z_NEG, 0);
final float[] center = VectorUtil.addVec3(forward, shiftedEyePos, forward);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
index 57aa76c82..e936bf991 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
@@ -46,6 +46,7 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -71,7 +72,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoClientRenderer;
import com.jogamp.opengl.util.stereo.StereoGLEventListener;
import com.jogamp.opengl.util.texture.Texture;
@@ -415,7 +416,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
", "+drawable.getClass().getName()+", "+drawable);
if(waitForKey) {
- UITestCase.waitForKey("Init>");
+ JunitTracer.waitForKey("Init>");
}
final Texture tex;
try {
@@ -639,9 +640,11 @@ public class MovieSBSStereo implements StereoGLEventListener {
GLArrayDataServer interleavedVBOCurrent = null;
+ private static final float[] vec3ScalePos = new float[] { 4f, 4f, 4f };
+
@Override
public void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height,
- final EyeParameter eyeParam, final EyePose eyePose) {
+ final EyeParameter eyeParam, final ViewerPose viewerPose) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
interleavedVBOCurrent = 0 == eyeParam.number ? interleavedVBOLeft : interleavedVBORight;
@@ -657,10 +660,11 @@ public class MovieSBSStereo implements StereoGLEventListener {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
final Quaternion rollPitchYaw = new Quaternion();
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, eyePose.position, 0);
+ final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ VectorUtil.scaleVec3(shiftedEyePos, shiftedEyePos, vec3ScalePos); // amplify viewerPose position
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);
- rollPitchYaw.mult(eyePose.orientation);
+ rollPitchYaw.mult(viewerPose.orientation);
final float[] up = rollPitchYaw.rotateVector(vec3Tmp2, 0, VectorUtil.VEC3_UNIT_Y, 0);
final float[] forward = rollPitchYaw.rotateVector(vec3Tmp3, 0, VectorUtil.VEC3_UNIT_Z_NEG, 0);
final float[] center = VectorUtil.addVec3(forward, shiftedEyePos, forward);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
index 3210762b1..82268958f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
@@ -6,9 +6,15 @@
#define mgl_FragColor gl_FragColor
#endif
+#ifdef GL_ES
+ #define MEDIUMP mediump
+#else
+ #define MEDIUMP
+#endif
+
// [0].rgba: 0, smooth, attnMinSz, attnMaxSz
// [1].rgba: attnCoeff(3), attnFadeTs
-uniform vec4 mgl_PointParams[2];
+uniform MEDIUMP vec4 mgl_PointParams[2];
#define pointSmooth (mgl_PointParams[0].g)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
index 4fa49b901..562874785 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
@@ -4,12 +4,18 @@
#define varying out
#endif
+#ifdef GL_ES
+ #define MEDIUMP mediump
+#else
+ #define MEDIUMP
+#endif
+
uniform vec4 mgl_ColorStatic;
uniform mat4 mgl_PMVMatrix[4]; // P, Mv, Mvi and Mvit (transpose(inverse(ModelView)) == normalMatrix)
// [0].rgba: 0, smooth, attnMinSz, attnMaxSz
// [1].rgba: attnCoeff(3), attnFadeTs
-uniform vec4 mgl_PointParams[2];
+uniform MEDIUMP vec4 mgl_PointParams[2];
#define pointSmooth (mgl_PointParams[0].g)
#define pointSizeMin (mgl_PointParams[0].b)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java
index 693f2f72b..0d1f1700d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java
@@ -34,8 +34,10 @@ import java.util.Arrays;
import com.jogamp.nativewindow.util.DimensionImmutable;
import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
import jogamp.opengl.util.stereo.GenericStereoDevice;
@@ -244,11 +246,6 @@ public class StereoDemo01 {
}
System.err.println("StereoDevice "+stereoDevice);
- // Start the sensor which provides the Rift’s pose and motion.
- if( !stereoDevice.startSensors(true) ) {
- System.err.println("Could not start sensors on device "+deviceIndex);
- }
-
//
//
//
@@ -260,6 +257,11 @@ public class StereoDemo01 {
final MonitorDevice monitor = StereoDeviceUtil.getMonitorDevice(stereoDevice, true);
final Screen screen = monitor.getScreen();
+ // Start the sensor which provides the Rift’s pose and motion.
+ if( !stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0) ) {
+ System.err.println("Could not start sensors on device "+deviceIndex);
+ }
+
final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true /* favorHardwareRasterizer */));
final GLWindow window = GLWindow.create(screen, caps);
@@ -334,8 +336,30 @@ public class StereoDemo01 {
return;
}
switch(e.getKeySymbol()) {
+ case KeyEvent.VK_O: {
+ window.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable drawable) {
+ stereoDevice.resetLocationSensorOrigin();
+ return true;
+ } });
+ break;
+ }
+ case KeyEvent.VK_P: {
+ window.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable drawable) {
+ System.err.println(stereoDeviceRenderer.getLastViewerPose());
+ return true;
+ } });
+ break;
+ }
case KeyEvent.VK_R: {
- stereoDevice.startSensors(!stereoDevice.getSensorsStarted());
+ if( stereoDevice.getSensorsStarted() ) {
+ stereoDevice.stopSensors();
+ } else {
+ stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0);
+ }
break;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index d9e9fc0cb..bdb03ba1d 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -36,7 +36,10 @@ import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.atomic.AtomicInteger;
import java.awt.AWTException;
import java.awt.EventQueue;
+import java.awt.MouseInfo;
+import java.awt.Point;
import java.awt.Robot;
+import java.awt.event.InputEvent;
import com.jogamp.nativewindow.NativeWindow;
import com.jogamp.nativewindow.NativeWindowFactory;
@@ -579,6 +582,25 @@ public class AWTRobotUtil {
Assert.assertEquals("Wrong key count", typeCount, counter.getCount()-c0);
}
+ public static void mouseMove(final Robot robot, final Point destination, final int iter, final int delay) {
+ final Point origin = MouseInfo.getPointerInfo().getLocation();
+ for (int i = 1; i <= iter; i++) {
+ final float alpha = i / (float) iter;
+ robot.mouseMove((int) (origin.x * (1 - alpha) + destination.x * alpha),
+ (int) (origin.y * (1 - alpha) + destination.y * alpha));
+ robot.delay(delay);
+ }
+ }
+ public static void mouseClick(final Robot robot, final Point pos, final int moveIter, final int moveDelay, final int actionDelay) {
+ robot.delay(actionDelay);
+ mouseMove(robot, pos, moveIter, moveDelay);
+
+ robot.delay(actionDelay);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.delay(actionDelay);
+ }
+
static int mouseClick(final int i, final Robot robot, final int mouseButton,
final Object obj, final InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
{
diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
index a2887112f..76f73989a 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
@@ -34,10 +34,32 @@ import com.jogamp.opengl.JoglVersion;
public class DumpGLInfo implements GLEventListener {
+ final String header;
+ final boolean withGLAvailability;
+ final boolean withCapabilities;
+ final boolean withExtensions;
+
+ public DumpGLInfo(final String header, final boolean withGLAvailability, final boolean withCapabilities, final boolean withExtensions) {
+ this.header = header;
+ this.withGLAvailability = withGLAvailability;
+ this.withCapabilities = withCapabilities;
+ this.withExtensions = withExtensions;
+ }
+ public DumpGLInfo() {
+ this.header = null;
+ this.withGLAvailability = true;
+ this.withCapabilities = true;
+ this.withExtensions = true;
+ }
public void init(final GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
- System.err.println(JoglVersion.getGLInfo(gl, null, true));
+ if( null != header ) {
+ System.err.println(header);
+ }
+ System.err.println(JoglVersion.getGLInfo(gl, null, withGLAvailability, withCapabilities, withExtensions));
+ System.err.println("Drawable: "+drawable.getDelegatedDrawable().getClass().getSimpleName());
+ System.err.println(drawable.getChosenGLCapabilities());
}
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {