aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-07-18 03:50:02 +0200
committerSven Gothel <[email protected]>2015-07-18 03:50:02 +0200
commit53966f92042d44483cb44f6c6b3c95a6a1fdd325 (patch)
tree12e5d23ad9bf6607f97cea59110b003baf356c4f /src/test/com/jogamp/opengl
parent07823202e897751e742a9a96d7d683033c5e07d5 (diff)
Bug 1151 - Working OculusVR SDK 0.5.0.1 on GNU/Linux w/ Positional Tracker (DK2)
Note: The ovrd server must run, otherwise no device is being detected. General Stereo API Changes: - EyePose -> ViewerPose - We only use the viewer pose and derive the pupile position via EyeParameter. - Hence we reduce complexity. - A single ViewerPose will be maintained by StereoDeviceRenderer - position is in meter, allowing StereoGLEventListener to scale device independent. - StereoDevice receives knowledge of certain sensors, to be queried and used for start-sensors. OVR: - Simply apply the above general changes - Build: Remove [more] unused API entries for SDK rendering
Diffstat (limited to 'src/test/com/jogamp/opengl')
-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.java11
-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/stereo/StereoDemo01.java8
4 files changed, 26 insertions, 15 deletions
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..9b414d7c5 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,11 @@ 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);
+ 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/stereo/StereoDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java
index 693f2f72b..c2e808770 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
@@ -245,7 +245,7 @@ public class StereoDemo01 {
System.err.println("StereoDevice "+stereoDevice);
// Start the sensor which provides the Rift’s pose and motion.
- if( !stereoDevice.startSensors(true) ) {
+ if( !stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0) ) {
System.err.println("Could not start sensors on device "+deviceIndex);
}
@@ -335,7 +335,11 @@ public class StereoDemo01 {
}
switch(e.getKeySymbol()) {
case KeyEvent.VK_R: {
- stereoDevice.startSensors(!stereoDevice.getSensorsStarted());
+ if( stereoDevice.getSensorsStarted() ) {
+ stereoDevice.stopSensors();
+ } else {
+ stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0);
+ }
break;
}
}