summaryrefslogtreecommitdiffstats
path: root/src/oculusvr/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-27 14:25:07 +0100
committerSven Gothel <[email protected]>2015-03-27 14:25:07 +0100
commitd09a50bdc7aca2d441fe7c595711a44fe9dc4a23 (patch)
tree54c676d1dd10c8afdb48018e6d5cdc5b4d24835c /src/oculusvr/classes
parent3b7a8f5f4e89adf84fd871c1440859ed3d89802e (diff)
Bug 1116: Oculus SDK 0.4.4: Add extra DK1 detection; Add call to ovr_Shutdown() and ovrHmd_Destroy(hmdDesc).
Add extra DK1 detection - SDK 0.4.4 w/ DK1 (Linux): ovrHmd_Detect() returns zero! - In such case: Try creating one device, which works for DK1 on Linux Add call to ovr_Shutdown() and ovrHmd_Destroy(hmdDesc). - Add StereoDeviceFactory.shutdown() and call ovr_Shutdown() for in OVRStereoDeviceFactory.shutdown(). - Call ovrHmd_Destroy(hmdDesc) in OVRStereoDevice.dispose().
Diffstat (limited to 'src/oculusvr/classes')
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java8
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java27
2 files changed, 31 insertions, 4 deletions
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
index 89f7797ae..fda554fdd 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
@@ -49,11 +49,11 @@ public class OVRStereoDevice implements StereoDevice {
private static final float[] DEFAULT_EYE_POSITION_OFFSET = { 0.0f, 1.6f, -5.0f };
private final StereoDeviceFactory factory;
- public final OvrHmdContext handle;
public final int deviceIndex;
- public final ovrHmdDesc hmdDesc;
private final FovHVHalves[] defaultEyeFov;
+ public ovrHmdDesc hmdDesc;
+ public OvrHmdContext handle;
private boolean sensorsStarted = false;
private final int[] eyeRenderOrder;
private final int supportedDistortionBits, recommendedDistortionBits, minimumDistortionBits;
@@ -128,7 +128,9 @@ public class OVRStereoDevice implements StereoDevice {
@Override
public final void dispose() {
- // NOP
+ OVR.ovrHmd_Destroy(hmdDesc);
+ hmdDesc = null;
+ handle = null;
}
@Override
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
index 21d6cab7b..eecc15c3f 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
@@ -29,6 +29,7 @@ package jogamp.opengl.oculusvr;
import com.jogamp.oculusvr.OVR;
import com.jogamp.oculusvr.OVRVersion;
+import com.jogamp.oculusvr.OvrHmdContext;
import com.jogamp.oculusvr.ovrHmdDesc;
import com.jogamp.opengl.util.stereo.StereoDeviceConfig;
import com.jogamp.opengl.util.stereo.StereoDevice;
@@ -38,7 +39,26 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory {
public static boolean isAvailable() {
if( OVR.ovr_Initialize() ) { // recursive ..
- return 0 < OVR.ovrHmd_Detect();
+ boolean res = false;
+ final int count = OVR.ovrHmd_Detect();
+ System.err.println("Detect.0: ovrHmd_Detect() -> "+count);
+ if( 0 < count ) {
+ res = true;
+ } else {
+ // SDK 0.4.4 w/ DK1 (Linux): ovrHmd_Detect() returns zero!
+ final ovrHmdDesc hmdDesc = OVR.ovrHmd_Create(0);
+ if( null != hmdDesc ) {
+ final OvrHmdContext ctx = hmdDesc.getHandle();
+ if( null != ctx ) {
+ res = true;
+ System.err.println("Detect.1: hmdDesc: "+hmdDesc.getProductNameAsString());
+ }
+ OVR.ovrHmd_Destroy(hmdDesc);
+ }
+ }
+ return res;
+ } else {
+ System.err.println("ovr_Initialize() failed");
}
return false;
}
@@ -69,4 +89,9 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory {
final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdDesc, deviceIndex);
return ctx;
}
+
+ @Override
+ public final void shutdown() {
+ OVR.ovr_Shutdown();
+ }
}