aboutsummaryrefslogtreecommitdiffstats
path: root/src/oculusvr/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/oculusvr/classes/jogamp')
-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();
+ }
}