From bb6a8fdc8decdbec64bbab0fe2175e76211d0e77 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 26 Mar 2015 23:36:50 +0100 Subject: Bug 1116 - Add OculusVR DK2 Support - Part-2 (DK1 and DK2 on DK2 SDK w/ Eye Tracker if available) --- .../jogamp/opengl/oculusvr/OVRStereoDevice.java | 72 +++++++++++----------- .../opengl/oculusvr/OVRStereoDeviceFactory.java | 8 +-- .../opengl/oculusvr/OVRStereoDeviceRenderer.java | 40 ++++++------ .../classes/jogamp/opengl/oculusvr/OVRUtil.java | 2 +- 4 files changed, 62 insertions(+), 60 deletions(-) (limited to 'src/oculusvr/classes/jogamp/opengl') diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java index 3dadb94b0..89f7797ae 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java @@ -64,15 +64,18 @@ public class OVRStereoDevice implements StereoDevice { private final PointImmutable position; private final int dkVersion; - public OVRStereoDevice(final StereoDeviceFactory factory, final OvrHmdContext nativeContext, final int deviceIndex) { + public OVRStereoDevice(final StereoDeviceFactory factory, final ovrHmdDesc hmdDesc, final int deviceIndex) { + if( null == hmdDesc ) { + throw new IllegalArgumentException("Passed null hmdDesc"); + } + final OvrHmdContext nativeContext = hmdDesc.getHandle(); if( null == nativeContext ) { - throw new IllegalArgumentException("Passed null nativeContext"); + throw new IllegalArgumentException("hmdDesc has null OvrHmdContext"); } this.factory = factory; this.handle = nativeContext; this.deviceIndex = deviceIndex; - this.hmdDesc = ovrHmdDesc.create(); - OVR.ovrHmd_GetDesc(handle, hmdDesc); + this.hmdDesc = hmdDesc; final ovrFovPort[] defaultOVREyeFov = hmdDesc.getDefaultEyeFov(0, new ovrFovPort[ovrHmdDesc.getEyeRenderOrderArrayLength()]); defaultEyeFov = new FovHVHalves[defaultOVREyeFov.length]; for(int i=0; i