diff options
author | Sven Gothel <[email protected]> | 2014-06-25 10:18:56 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-25 10:18:56 +0200 |
commit | a515faf5e7d679b7ad87a05fa8fc81ab148bcd41 (patch) | |
tree | 299dec6843e76f6a61b6de96720505b9082dd64d /src/oculusvr | |
parent | e1dc63254918092b1066983657194b198f6389e5 (diff) |
Bug 1021: Enhance OVR GlueGen Mapping / Adapt to GlueGen commit 9ee44e1a289ecbac024662dd5a2ffc42e8add023 (Bug 1025)
Diffstat (limited to 'src/oculusvr')
-rw-r--r-- | src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java | 71 |
1 files changed, 57 insertions, 14 deletions
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java index a7c64940f..25db640e4 100644 --- a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java +++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2014 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -64,19 +64,10 @@ public class OVRVersion extends JogampVersion { if( !OVR.ovr_Initialize() ) { // recursive .. sb.append("\tOVR not available").append(Platform.getNewline()); } else { - final long ovrHmdHandle = OVR.ovrHmd_Create(ovrHmdIndex); - if( 0 != ovrHmdHandle ) { - ovrHmdDesc hmdDesc = ovrHmdDesc.create(); - OVR.ovrHmd_GetDesc(ovrHmdHandle, hmdDesc); - 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()); - final ovrSizei resolution = hmdDesc.getResolution(); - sb.append("\thmd."+ovrHmdIndex+".resolution:\t"+resolution.getW()+"x"+resolution.getH()).append(Platform.getNewline()); - ovrVector2i winPos = hmdDesc.getWindowsPos(); - sb.append("\thmd."+ovrHmdIndex+".winPos:\t"+winPos.getX()+" / "+winPos.getY()).append(Platform.getNewline()); - OVR.ovrHmd_Destroy(ovrHmdHandle); + final OvrHmdContext ovrHmdCtx = OVR.ovrHmd_Create(ovrHmdIndex); + if( null != ovrHmdCtx ) { + getAvailableCapabilitiesInfo(ovrHmdCtx, ovrHmdIndex, sb); + OVR.ovrHmd_Destroy(ovrHmdCtx); } else { sb.append("\thmd."+ovrHmdIndex+" not available").append(Platform.getNewline()); } @@ -85,6 +76,58 @@ public class OVRVersion extends JogampVersion { sb.append(Platform.getNewline()); return sb; } + /** + * + * @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(); + } + ovrHmdDesc hmdDesc = ovrHmdDesc.create(); + OVR.ovrHmd_GetDesc(ovrHmdCtx, hmdDesc); + getAvailableCapabilitiesInfo(hmdDesc, ovrHmdIndex, sb); + + 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(ovrHmdDesc hmdDesc, final int ovrHmdIndex, StringBuilder sb) { + 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+".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()); + final ovrSizei resolution = hmdDesc.getResolution(); + sb.append("\thmd."+ovrHmdIndex+".resolution:\t"+resolution.getW()+"x"+resolution.getH()).append(Platform.getNewline()); + ovrVector2i winPos = hmdDesc.getWindowsPos(); + sb.append("\thmd."+ovrHmdIndex+".winPos:\t"+winPos.getX()+" / "+winPos.getY()).append(Platform.getNewline()); + return sb; + } public static StringBuilder getAllAvailableCapabilitiesInfo(StringBuilder sb) { if(null==sb) { |