diff options
Diffstat (limited to 'src')
4 files changed, 26 insertions, 13 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java index 24eba6ec1..3586aaa4b 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java +++ b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java @@ -90,6 +90,8 @@ public class StereoDeviceUtil { System.err.println("StereoDevice Set Mode: "+newMode); monitor.setCurrentMode(newMode); } + final MonitorMode queriedMode = monitor.queryCurrentMode(); + System.err.println("StereoDevice Post-Set Mode: "+queriedMode); } else { System.err.println("StereoDevice Keeps Mode: "+currentMode); } diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java index 44bf13cd3..5025e80c5 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java @@ -86,14 +86,6 @@ public class OVRStereoDevice implements StereoDevice { this.deviceIndex = deviceIndex; this.hmdDesc = hmdDesc; - { - final FovHVHalves posFov = FovHVHalves.byRadians(hmdDesc.getCameraFrustumHFovInRadians(), - hmdDesc.getCameraFrustumVFovInRadians()); - final float posZNear = hmdDesc.getCameraFrustumNearZInMeters(); - final float posZFar = hmdDesc.getCameraFrustumFarZInMeters(); - locationSensorParams = new LocationSensorParameter(new Frustum.FovDesc(posFov, posZNear, posZFar)); - } - final ovrFovPort[] defaultOVREyeFov = hmdDesc.getDefaultEyeFov(0, new ovrFovPort[ovrHmdDesc.getEyeRenderOrderArrayLength()]); defaultEyeFov = new FovHVHalves[defaultOVREyeFov.length]; for(int i=0; i<defaultEyeFov.length; i++) { @@ -108,6 +100,21 @@ public class OVRStereoDevice implements StereoDevice { usedSensorBits = 0; supportedSensorBits = OVRUtil.ovrTrackingCaps2SensorBits(hmdDesc.getTrackingCaps()); + LocationSensorParameter _locationSensorParams = null; + if( StereoUtil.usesPositionSensor(supportedSensorBits)) { + try { + final FovHVHalves posFov = FovHVHalves.byRadians(hmdDesc.getCameraFrustumHFovInRadians(), + hmdDesc.getCameraFrustumVFovInRadians()); + final float posZNear = hmdDesc.getCameraFrustumNearZInMeters(); + final float posZFar = hmdDesc.getCameraFrustumFarZInMeters(); + _locationSensorParams = new LocationSensorParameter(new Frustum.FovDesc(posFov, posZNear, posZFar)); + } catch (final IllegalArgumentException iae) { + // probably zNear/zFar issue .. + System.err.println(iae.getMessage()); + } + } + locationSensorParams = _locationSensorParams; + // DK1 delivers unrotated resolution in target orientation // DK2 delivers rotated resolution in target orientation, monitor screen is rotated 90deg clockwise deviceName = hmdDesc.getDisplayDeviceNameAsString(); diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java index 5487ca087..95565dd0f 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java @@ -553,6 +553,10 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { final ovrVector3f pos = pose.getPosition(); viewerPose.setPosition(pos.getX(), pos.getY(), pos.getZ()); OVRUtil.copyToQuaternion(pose.getOrientation(), viewerPose.orientation); + + // System.err.println("Viewer: "+OVRUtil.toString(pos)); + // System.err.println("Camera: "+OVRUtil.toString(trackingState.getCameraPose().getPosition())); + // System.err.println("Leveld: "+OVRUtil.toString(trackingState.getLeveledCameraPose().getPosition())); return viewerPose; } 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 df8e2bef6..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 @@ -246,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(stereoDevice.getSupportedSensorBits(), 0) ) { - System.err.println("Could not start sensors on device "+deviceIndex); - } - // // // @@ -262,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); |