diff options
author | Sven Gothel <[email protected]> | 2015-03-26 23:36:50 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-26 23:36:50 +0100 |
commit | bb6a8fdc8decdbec64bbab0fe2175e76211d0e77 (patch) | |
tree | 463fd9d6b4d72decc418d408ed924cbb02315da8 /src/oculusvr | |
parent | 900f1f2a877aacfa750388419f05c0c13d6c5f26 (diff) |
Bug 1116 - Add OculusVR DK2 Support - Part-2 (DK1 and DK2 on DK2 SDK w/ Eye Tracker if available)
Diffstat (limited to 'src/oculusvr')
5 files changed, 73 insertions, 95 deletions
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java index cf6eb5dda..9be37e193 100644 --- a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java +++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java @@ -33,9 +33,7 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; import com.jogamp.common.util.JogampVersion; import com.jogamp.oculusvr.OVR; -import com.jogamp.oculusvr.OvrHmdContext; import com.jogamp.oculusvr.ovrHmdDesc; -import com.jogamp.oculusvr.ovrSensorDesc; import com.jogamp.oculusvr.ovrSizei; import com.jogamp.oculusvr.ovrVector2i; @@ -69,10 +67,10 @@ public class OVRVersion extends JogampVersion { if( !OVR.ovr_Initialize() ) { // recursive .. sb.append("\tOVR not available").append(Platform.getNewline()); } else { - final OvrHmdContext ovrHmdCtx = OVR.ovrHmd_Create(ovrHmdIndex); - if( null != ovrHmdCtx ) { - getAvailableCapabilitiesInfo(ovrHmdCtx, ovrHmdIndex, sb); - OVR.ovrHmd_Destroy(ovrHmdCtx); + final ovrHmdDesc hmdDesc = OVR.ovrHmd_Create(ovrHmdIndex); + if( null != hmdDesc ) { + getAvailableCapabilitiesInfo(hmdDesc, ovrHmdIndex, sb); + OVR.ovrHmd_Destroy(hmdDesc); } else { sb.append("\thmd."+ovrHmdIndex+" not available").append(Platform.getNewline()); } @@ -83,50 +81,28 @@ public class OVRVersion extends JogampVersion { } /** * - * @param ovrHmdCtx - * @param ovrHmdIndex only for informal purposes, OVR HMD index of created <code>ovrHmdHandle</code> - * @param sb - * @return - */ - public static StringBuilder getAvailableCapabilitiesInfo(final OvrHmdContext ovrHmdCtx, final int ovrHmdIndex, StringBuilder sb) { - if(null == ovrHmdCtx) { - throw new IllegalArgumentException("null ovrHmdHandle"); - } - if(null==sb) { - sb = new StringBuilder(); - } - final ovrHmdDesc hmdDesc = ovrHmdDesc.create(); - OVR.ovrHmd_GetDesc(ovrHmdCtx, hmdDesc); - getAvailableCapabilitiesInfo(hmdDesc, ovrHmdIndex, sb); - - final ovrSensorDesc sensorDesc = ovrSensorDesc.create(); - if( OVR.ovrHmd_GetSensorDesc(ovrHmdCtx, sensorDesc) ) { - sb.append("\thmd."+ovrHmdIndex+".sensor.productId:\t0x"+Integer.toHexString(sensorDesc.getProductId())).append(Platform.getNewline()); - sb.append("\thmd."+ovrHmdIndex+".sensor.vendorId:\t0x"+Integer.toHexString(sensorDesc.getVendorId())).append(Platform.getNewline()); - sb.append("\thmd."+ovrHmdIndex+".sensor.serial:\t"+sensorDesc.getSerialNumberAsString()).append(Platform.getNewline()); - } else { - sb.append("\thmd."+ovrHmdIndex+".sensor:\tn/a").append(Platform.getNewline()); - } - return sb; - } - /** - * * @param hmdDesc * @param ovrHmdIndex only for informal purposes, OVR HMD index of <code>hmdDesc</code> * @param sb * @return */ public static StringBuilder getAvailableCapabilitiesInfo(final ovrHmdDesc hmdDesc, final int ovrHmdIndex, StringBuilder sb) { + if(null == hmdDesc) { + throw new IllegalArgumentException("null hmdDesc"); + } if(null==sb) { sb = new StringBuilder(); } sb.append("\thmd."+ovrHmdIndex+".productName:\t"+hmdDesc.getProductNameAsString()).append(Platform.getNewline()); sb.append("\thmd."+ovrHmdIndex+".vendorName:\t"+hmdDesc.getManufacturerAsString()).append(Platform.getNewline()); sb.append("\thmd."+ovrHmdIndex+".deviceName:\t"+hmdDesc.getDisplayDeviceNameAsString()).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".productId:\t0x"+Integer.toHexString(hmdDesc.getProductId())).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".vendorId:\t0x"+Integer.toHexString(hmdDesc.getVendorId())).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".serial:\t"+hmdDesc.getSerialNumberAsString()).append(Platform.getNewline()); sb.append("\thmd."+ovrHmdIndex+".type:\t"+hmdDesc.getType()).append(Platform.getNewline()); sb.append("\thmd."+ovrHmdIndex+".hmdCaps:\t"+hmdDesc.getHmdCaps()).append(Platform.getNewline()); sb.append("\thmd."+ovrHmdIndex+".distorCaps:\t"+hmdDesc.getDistortionCaps()).append(Platform.getNewline()); - sb.append("\thmd."+ovrHmdIndex+".sensorCaps:\t"+hmdDesc.getSensorCaps()).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".sensorCaps:\t"+hmdDesc.getTrackingCaps()).append(Platform.getNewline()); final ovrSizei resolution = hmdDesc.getResolution(); sb.append("\thmd."+ovrHmdIndex+".resolution:\t"+resolution.getW()+"x"+resolution.getH()).append(Platform.getNewline()); final ovrVector2i winPos = hmdDesc.getWindowsPos(); 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<defaultEyeFov.length; i++) { @@ -89,12 +92,18 @@ public class OVRStereoDevice implements StereoDevice { deviceName = hmdDesc.getDisplayDeviceNameAsString(); final ovrSizei res = hmdDesc.getResolution(); resolution = new Dimension(res.getW(), res.getH()); - if( "OVR0002".equals(deviceName) || "OVR0003".equals(deviceName) ) { - dkVersion = 2; - requiredRotation = 90; - } else { - dkVersion = 1; - requiredRotation = 0; + final int hmdType = hmdDesc.getType(); + switch( hmdType ) { + case OVR.ovrHmd_DKHD: // 4 + case 5: // OVR.ovrHmd_CrystalCoveProto: + case OVR.ovrHmd_DK2: // 6 + dkVersion = 2; + requiredRotation = 90; + break; + default: + dkVersion = 1; + requiredRotation = 0; + break; } position = OVRUtil.getVec2iAsPoint(hmdDesc.getWindowsPos()); } @@ -144,9 +153,12 @@ public class OVRStereoDevice implements StereoDevice { public final boolean startSensors(final boolean start) { if( start && !sensorsStarted ) { // Start the sensor which provides the Rift’s pose and motion. - final int requiredSensorCaps = 0; - final int supportedSensorCaps = requiredSensorCaps | OVR.ovrSensorCap_Orientation | OVR.ovrSensorCap_YawCorrection | OVR.ovrSensorCap_Position; - if( OVR.ovrHmd_StartSensor(handle, supportedSensorCaps, requiredSensorCaps) ) { + final int requiredTrackingCaps = 0; + final int supportedTrackingCaps = requiredTrackingCaps | + OVR.ovrTrackingCap_Orientation | + OVR.ovrTrackingCap_MagYawCorrection | + OVR.ovrTrackingCap_Position; + if( OVR.ovrHmd_ConfigureTracking(hmdDesc, supportedTrackingCaps, requiredTrackingCaps) ) { sensorsStarted = true; return true; } else { @@ -154,7 +166,7 @@ public class OVRStereoDevice implements StereoDevice { return false; } } else if( sensorsStarted ) { - OVR.ovrHmd_StopSensor(handle); + OVR.ovrHmd_ConfigureTracking(hmdDesc, 0, 0); // STOP sensorsStarted = false; return true; } else { @@ -193,20 +205,20 @@ public class OVRStereoDevice implements StereoDevice { final ovrFovPort ovrEyeFov1 = OVRUtil.getOVRFovPort(eyeFov[1]); final ovrEyeRenderDesc[] eyeRenderDesc = new ovrEyeRenderDesc[2]; - eyeRenderDesc[0] = OVR.ovrHmd_GetRenderDesc(handle, OVR.ovrEye_Left, ovrEyeFov0); - eyeRenderDesc[1] = OVR.ovrHmd_GetRenderDesc(handle, OVR.ovrEye_Right, ovrEyeFov1); + eyeRenderDesc[0] = OVR.ovrHmd_GetRenderDesc(hmdDesc, OVR.ovrEye_Left, ovrEyeFov0); + eyeRenderDesc[1] = OVR.ovrHmd_GetRenderDesc(hmdDesc, OVR.ovrEye_Right, ovrEyeFov1); if( StereoDevice.DEBUG ) { System.err.println("XXX: eyeRenderDesc[0] "+OVRUtil.toString(eyeRenderDesc[0])); System.err.println("XXX: eyeRenderDesc[1] "+OVRUtil.toString(eyeRenderDesc[1])); } - final DimensionImmutable eye0TextureSize = OVRUtil.getOVRSizei(OVR.ovrHmd_GetFovTextureSize(handle, OVR.ovrEye_Left, eyeRenderDesc[0].getFov(), pixelsPerDisplayPixel)); - final DimensionImmutable eye1TextureSize = OVRUtil.getOVRSizei(OVR.ovrHmd_GetFovTextureSize(handle, OVR.ovrEye_Right, eyeRenderDesc[1].getFov(), pixelsPerDisplayPixel)); + final DimensionImmutable eye0TextureSize = OVRUtil.getOVRSizei(OVR.ovrHmd_GetFovTextureSize(hmdDesc, OVR.ovrEye_Left, eyeRenderDesc[0].getFov(), pixelsPerDisplayPixel)); + final DimensionImmutable eye1TextureSize = OVRUtil.getOVRSizei(OVR.ovrHmd_GetFovTextureSize(hmdDesc, OVR.ovrEye_Right, eyeRenderDesc[1].getFov(), pixelsPerDisplayPixel)); if( StereoDevice.DEBUG ) { System.err.println("XXX: recommenedTex0Size "+eye0TextureSize); System.err.println("XXX: recommenedTex1Size "+eye1TextureSize); } - final int maxWidth = Math.max(eye0TextureSize.getWidth(), eye1TextureSize.getWidth()); + // final int maxWidth = Math.max(eye0TextureSize.getWidth(), eye1TextureSize.getWidth()); final int maxHeight = Math.max(eye0TextureSize.getHeight(), eye1TextureSize.getHeight()); final DimensionImmutable[] eyeTextureSizes = new DimensionImmutable[] { eye0TextureSize, eye1TextureSize }; @@ -219,24 +231,14 @@ public class OVRStereoDevice implements StereoDevice { final RectangleImmutable[] eyeViewports = new RectangleImmutable[2]; if( 1 == textureCount ) { // validated in ctor below! // one big texture/FBO, viewport to target space - if( false && 2 == dkVersion ) { - eyeViewports[0] = new Rectangle(0, 0, - maxWidth, - eye0TextureSize.getHeight()); - eyeViewports[1] = new Rectangle(0, eye0TextureSize.getHeight(), - maxWidth, - eye1TextureSize.getHeight()); - } else { - eyeViewports[0] = new Rectangle(0, 0, - eye0TextureSize.getWidth(), - maxHeight); - eyeViewports[1] = new Rectangle(eye0TextureSize.getWidth(), 0, - eye1TextureSize.getWidth(), - maxHeight); - } + eyeViewports[0] = new Rectangle(0, 0, + eye0TextureSize.getWidth(), + maxHeight); + eyeViewports[1] = new Rectangle(eye0TextureSize.getWidth(), 0, + eye1TextureSize.getWidth(), + maxHeight); } else { // two textures/FBOs w/ postprocessing, which renders textures/FBOs into target space - // FIXME: DK2 eyeViewports[0] = new Rectangle(0, 0, eye0TextureSize.getWidth(), eye0TextureSize.getHeight()); diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java index dfaead1ea..ffe1371a4 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java @@ -29,7 +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; import com.jogamp.opengl.util.stereo.StereoDeviceFactory; @@ -45,15 +45,15 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory { @Override public final StereoDevice createDevice(final int deviceIndex, final StereoDeviceConfig config, final boolean verbose) { - final OvrHmdContext hmdCtx = OVR.ovrHmd_Create(deviceIndex); - if( null == hmdCtx ) { + final ovrHmdDesc hmdDesc = OVR.ovrHmd_Create(deviceIndex); + if( null == hmdDesc ) { if( verbose ) { System.err.println("Failed to create hmdCtx for device index "+deviceIndex+" on thread "+Thread.currentThread().getName()); Thread.dumpStack(); } return null; } - final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdCtx, deviceIndex); + final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdDesc, deviceIndex); if( verbose ) { System.err.println(OVRVersion.getAvailableCapabilitiesInfo(ctx.hmdDesc, deviceIndex, null).toString()); } diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java index 5da5cbeca..ff15d38d1 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java @@ -44,12 +44,12 @@ import jogamp.common.os.PlatformPropsImpl; import com.jogamp.common.nio.Buffers; import com.jogamp.oculusvr.OVR; import com.jogamp.oculusvr.OVRException; -import com.jogamp.oculusvr.OvrHmdContext; import com.jogamp.oculusvr.ovrDistortionMesh; import com.jogamp.oculusvr.ovrDistortionVertex; import com.jogamp.oculusvr.ovrEyeRenderDesc; import com.jogamp.oculusvr.ovrFovPort; import com.jogamp.oculusvr.ovrFrameTiming; +import com.jogamp.oculusvr.ovrHmdDesc; import com.jogamp.oculusvr.ovrMatrix4f; import com.jogamp.oculusvr.ovrPosef; import com.jogamp.oculusvr.ovrRecti; @@ -109,7 +109,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { @Override public final EyePose getLastEyePose() { return eyePose; } - private OVREye(final OvrHmdContext hmdCtx, final int distortionBits, + private OVREye(final ovrHmdDesc hmdDesc, final int distortionBits, final float[] eyePositionOffset, final ovrEyeRenderDesc eyeDesc, final ovrSizei ovrTextureSize, final RectangleImmutable eyeViewport) { this.eyeName = eyeDesc.getEye(); @@ -133,13 +133,13 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { this.ovrEyeDesc = eyeDesc; this.ovrEyeFov = eyeDesc.getFov(); - final ovrVector3f eyeViewAdjust = eyeDesc.getViewAdjust(); + final ovrVector3f eyeViewAdjust = eyeDesc.getHmdToEyeViewOffset(); this.eyeParameter = new EyeParameter(eyeName, eyePositionOffset, OVRUtil.getFovHV(ovrEyeFov), eyeViewAdjust.getX(), eyeViewAdjust.getY(), eyeViewAdjust.getZ()); this.eyePose = new EyePose(eyeName); - updateEyePose(hmdCtx); // 1st init + updateEyePose(hmdDesc); // 1st init // Setup: eyeToSourceUVScale, eyeToSourceUVOffset { @@ -167,7 +167,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { final ovrDistortionMesh meshData = ovrDistortionMesh.create(); final int ovrDistortionCaps = distBits2OVRDistCaps(distortionBits); - if( !OVR.ovrHmd_CreateDistortionMesh(hmdCtx, eyeName, ovrEyeFov, ovrDistortionCaps, meshData) ) { + if( !OVR.ovrHmd_CreateDistortionMesh(hmdDesc, eyeName, ovrEyeFov, ovrDistortionCaps, meshData) ) { throw new OVRException("Failed to create meshData for eye "+eyeName+", "+OVRUtil.toString(ovrEyeFov)+" and "+StereoUtil.distortionBitsToString(distortionBits)); } vertexCount = meshData.getVertexCount(); @@ -204,7 +204,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { System.err.println("XXX."+eyeName+": START VERTEX "+vertNum+" / "+vertexCount); } // pos - v = ov.getPos(); + v = ov.getScreenPosNDC(); if( StereoDevice.DUMP_DATA ) { System.err.println("XXX."+eyeName+": pos "+OVRUtil.toString(v)); } @@ -226,7 +226,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { iVBOFB.put(ov.getTimeWarpFactor()); // texCoordR - v = ov.getTexR(); + v = ov.getTanEyeAnglesR(); if( StereoDevice.DUMP_DATA ) { System.err.println("XXX."+eyeName+": texR "+OVRUtil.toString(v)); } @@ -235,7 +235,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { if( useChromatic ) { // texCoordG - v = ov.getTexG(); + v = ov.getTanEyeAnglesG(); if( StereoDevice.DUMP_DATA ) { System.err.println("XXX."+eyeName+": texG "+OVRUtil.toString(v)); } @@ -243,7 +243,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { iVBOFB.put(v.getY()); // texCoordB - v = ov.getTexB(); + v = ov.getTanEyeAnglesB(); if( StereoDevice.DUMP_DATA ) { System.err.println("XXX."+eyeName+": texB "+OVRUtil.toString(v)); } @@ -331,11 +331,11 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { } } - private void updateTimewarp(final OvrHmdContext hmdCtx, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2) { + private void updateTimewarp(final ovrHmdDesc hmdDesc, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2) { final ovrMatrix4f[] timeWarpMatrices = new ovrMatrix4f[2]; timeWarpMatrices[0] = ovrMatrix4f.create(); // FIXME: remove ctor / double check timeWarpMatrices[1] = ovrMatrix4f.create(); - OVR.ovrHmd_GetEyeTimewarpMatrices(hmdCtx, eyeName, eyeRenderPose, timeWarpMatrices); + OVR.ovrHmd_GetEyeTimewarpMatrices(hmdDesc, eyeName, eyeRenderPose, timeWarpMatrices); final float[] eyeRotationStartM = FloatUtil.transposeMatrix(timeWarpMatrices[0].getM(0, mat4Tmp1), mat4Tmp2); final FloatBuffer eyeRotationStartU = eyeRotationStart.floatBufferValue(); @@ -351,10 +351,10 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { /** * Updates {@link #ovrEyePose} and it's extracted * {@link #eyeRenderPoseOrientation} and {@link #eyeRenderPosePosition}. - * @param hmdCtx used get the {@link #ovrEyePose} via {@link OVR#ovrHmd_GetEyePose(OvrHmdContext, int)} + * @param hmdCtx used get the {@link #ovrEyePose} via {@link OVR#ovrHmd_GetHmdPosePerEye(ovrHmdDesc, int)} */ - private EyePose updateEyePose(final OvrHmdContext hmdCtx) { - ovrEyePose = OVR.ovrHmd_GetEyePose(hmdCtx, eyeName); + private EyePose updateEyePose(final ovrHmdDesc hmdDesc) { + ovrEyePose = OVR.ovrHmd_GetHmdPosePerEye(hmdDesc, eyeName); final ovrVector3f pos = ovrEyePose.getPosition(); eyePose.setPosition(pos.getX(), pos.getY(), pos.getZ()); OVRUtil.copyToQuaternion(ovrEyePose.getOrientation(), eyePose.orientation); @@ -436,8 +436,8 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { ovrTexture0Size = OVRUtil.createOVRSizei(eyeTextureSizes[0]); ovrTexture1Size = OVRUtil.createOVRSizei(eyeTextureSizes[1]); } - eyes[0] = new OVREye(context.handle, this.distortionBits, eyePositionOffset, eyeRenderDescs[0], ovrTexture0Size, eyeViewports[0]); - eyes[1] = new OVREye(context.handle, this.distortionBits, eyePositionOffset, eyeRenderDescs[1], ovrTexture1Size, eyeViewports[1]); + eyes[0] = new OVREye(context.hmdDesc, this.distortionBits, eyePositionOffset, eyeRenderDescs[0], ovrTexture0Size, eyeViewports[0]); + eyes[1] = new OVREye(context.hmdDesc, this.distortionBits, eyePositionOffset, eyeRenderDescs[1], ovrTexture1Size, eyeViewports[1]); sp = null; frameTiming = null; } @@ -545,12 +545,12 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { @Override public final EyePose updateEyePose(final int eyeNum) { - return eyes[eyeNum].updateEyePose(context.handle); + return eyes[eyeNum].updateEyePose(context.hmdDesc); } @Override public final void beginFrame(final GL gl) { - frameTiming = OVR.ovrHmd_BeginFrameTiming(context.handle, 0); + frameTiming = OVR.ovrHmd_BeginFrameTiming(context.hmdDesc, 0); } @Override @@ -558,7 +558,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { if( null == frameTiming ) { throw new IllegalStateException("beginFrame not called"); } - OVR.ovrHmd_EndFrameTiming(context.handle); + OVR.ovrHmd_EndFrameTiming(context.hmdDesc); frameTiming = null; } @@ -596,7 +596,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { public final void ppOneEye(final GL gl, final int eyeNum) { final OVREye eye = eyes[eyeNum]; if( StereoUtil.usesTimewarpDistortion(distortionBits) ) { - eye.updateTimewarp(context.handle, eye.ovrEyePose, mat4Tmp1, mat4Tmp2); + eye.updateTimewarp(context.hmdDesc, eye.ovrEyePose, mat4Tmp1, mat4Tmp2); } final GL2ES2 gl2es2 = gl.getGL2ES2(); diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java index 16aeac4b1..c1d01fea2 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java @@ -168,6 +168,6 @@ public class OVRUtil { return "["+desc.getEye()+", fov"+toString(desc.getFov())+ ", viewport"+toString(desc.getDistortedViewport())+ ", pptCtr"+toString(desc.getPixelsPerTanAngleAtCenter())+ - ", view-adjust"+toString(desc.getViewAdjust())+"]"; + ", view-adjust"+toString(desc.getHmdToEyeViewOffset())+"]"; } } |