diff options
author | Sven Gothel <[email protected]> | 2015-03-27 03:07:58 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-27 03:07:58 +0100 |
commit | e626312c79f49b2244b5fdae8dbbf1ee22520817 (patch) | |
tree | 717c760aa7f02bd67ca5ab020844286ae4caa367 | |
parent | bb6a8fdc8decdbec64bbab0fe2175e76211d0e77 (diff) |
Bug 1116: Oculus SDK 0.4.4 support for JOGL - Part-3: New set of C-files, adapt to new SDK API
- Tested on Windows and working StereoDemo01 w/ DK2!
-rw-r--r-- | make/build-oculusvr.xml | 87 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr-common.cfg | 19 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr.c | 2 | ||||
-rw-r--r-- | make/config/oculusvr/oculusvr.cfg | 1 | ||||
-rwxr-xr-x | make/scripts/tests-win.bat | 4 | ||||
-rw-r--r-- | make/scripts/tests.sh | 3 | ||||
m--------- | oculusvr-sdk | 0 | ||||
-rw-r--r-- | src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java | 11 | ||||
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java | 14 | ||||
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java | 5 | ||||
-rw-r--r-- | src/oculusvr/native/OVRImplMisc.cpp | 30 |
11 files changed, 95 insertions, 81 deletions
diff --git a/make/build-oculusvr.xml b/make/build-oculusvr.xml index 48d48056d..717322efa 100644 --- a/make/build-oculusvr.xml +++ b/make/build-oculusvr.xml @@ -403,71 +403,81 @@ <include name="${rootrel.generated.c}/OVR_JNI.c"/> </patternset> <patternset id="c.src.files.oculusvr.cpp"> - <include name="${rootrel.src.c}/OVRImplMisc.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_CAPI.cpp"/> - <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp"/--> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp"/> <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp"/--> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp"/--> <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_Util.cpp"/--> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GLE.cpp"/--> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_FrameTimeManager.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_GlobalState.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDRenderState.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDState.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_DeviceHandle.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_DeviceImpl.cpp"/> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HSWDisplay.cpp"/ --> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_LatencyStatistics.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_JSON.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_LatencyTestImpl.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Profile.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorCalibration.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorFilter.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorFusion.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorImpl.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Sensor2Impl.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorImpl_Common.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SensorTimeFilter.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SerialFormat.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Stereo.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_ThreadCommandQueue.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Alg.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Allocator.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Atomic.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_CRC32.cpp"/> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_DebugHelp.cpp"/ --> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_File.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_FileFILE.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Lockless.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Log.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Math.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Recording.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_RefCount.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_SharedMemory.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Std.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String_FormatUtil.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String_PathUtil.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_SysFile.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_System.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadCommandQueue.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isLinux"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isOSX"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp" if="isWindows"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Timer.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_UTF8Util.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_LatencyTest.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_LatencyTest2.cpp"/> + + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_ImageWindow.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Interface.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_LatencyTest2Reader.cpp"/> <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Render_Stereo.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemGUI.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemInfo.cpp"/> + + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Display.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_Display.cpp" if="isLinux"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_SDKWindow.cpp" if="isLinux"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_OSX_Display.cpp" if="isOSX"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_Display.cpp" if="isWindows"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_FocusReader.cpp" if="isWindows"/> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_RenderShim.cpp" if="isWindows"/ --> + <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_ShimFunctions.cpp" if="isWindows"/ --> + + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_BitStream.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_NetworkPlugin.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_PacketizedTCPSocket.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_RPC1.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Session.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Socket.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Unix_Socket.cpp" if="isLinux"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Unix_Socket.cpp" if="isOSX"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Win32_Socket.cpp" if="isWindows"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Service/Service_NetClient.cpp"/> + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Service/Service_NetSessionCommon.cpp"/> + + <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp"/> + <include name="${rootrel.oculusvr.sdk}/3rdParty/TinyXml/tinyxml2.cpp"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_HIDDevice.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_SensorDevice.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_DeviceManager.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_HMDDevice.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_SensorDevice.cpp" if="isLinux"/> - <include name="${rootrel.oculusvr.sdk}/3rdParty/EDID/edid.cpp" if="isLinux"/> - - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp" if="isWindows"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Win32_DeviceManager.cpp" if="isWindows"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Win32_DeviceStatus.cpp" if="isWindows"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Win32_HIDDevice.cpp" if="isWindows"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Win32_HMDDevice.cpp" if="isWindows"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Win32_SensorDevice.cpp" if="isWindows"/> - - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isOSX"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_OSX_DeviceManager.cpp" if="isOSX"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_OSX_HIDDevice.cpp" if="isOSX"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_OSX_HMDDevice.cpp" if="isOSX"/> - <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_OSX_SensorDevice.cpp" if="isOSX"/> + <include name="${rootrel.oculusvr.sdk}/3rdParty/EDID/edid.cpp" if="isLinux"/> </patternset> <echo message="Compiling @{output.lib.name}" /> @@ -538,6 +548,7 @@ <compilerarg location="start" value="c++" if="isCLANG"/> <compilerarg value="-fno-rtti"/> + <compilerarg value="-DHEADLESS_APP=1"/> <compilerarg value="-municode" if="isMingW"/> <compilerarg value="-DUNICODE" if="isMingW"/> @@ -560,6 +571,8 @@ <linker extends="@{linker.cfg.id}"> <syslibset libs="setupapi, winmm" if="isWindows"/> <syslibset libs="gdi32, kernel32" if="isWindows"/> + <syslibset libs="version" if="isWindows"/> + <syslibset libs="ws2_32" if="isWindows"/> <syslibset libs="X11 Xrandr udev m" if="isLinux" unless="isLinuxARMv6" /> <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" diff --git a/make/config/oculusvr/oculusvr-common.cfg b/make/config/oculusvr/oculusvr-common.cfg index c330ce5be..86d0ce745 100644 --- a/make/config/oculusvr/oculusvr-common.cfg +++ b/make/config/oculusvr/oculusvr-common.cfg @@ -17,14 +17,23 @@ RuntimeExceptionType OVRException # Mappings for data types Opaque boolean ovrBool -# Not implemented in SDK !? -Ignore ovrHmd_ProcessLatencyTest - # Not native sized: CType['uintptr_t *', size [fixed false, lnx64 64], [array*1]] Ignore ovrRenderAPIConfig.PlatformData # Not native sized: CType['uintptr_t *', size [fixed false, lnx64 64], [array*1]] Ignore ovrTexture.PlatformData +# We use the SDK in headless mode: +# #define HEADLESS_APP 1 +# implying: ovrHmdCap_ExtendDesktop +# +Ignore ovr_InitializeRenderingShim +Ignore ovrHmd_RegisterPostDistortionCallback +Ignore ovrHmd_AttachToWindow +# HSW = Health and Safety Warning +Ignore ovrHSWDisplayState +Ignore ovrHmd_GetHSWDisplayState +Ignore ovrHmd_DismissHSWDisplay + # These routines use or return strings ReturnsString ovrHmd_GetLastError ReturnsString ovrHmd_GetLatencyTestResult @@ -39,8 +48,8 @@ ReturnedArrayLength ovrHmdDesc.Handle 1 ReturnedArrayLength ovrDistortionMesh.pVertexData getVertexCount() ReturnedArrayLength ovrDistortionMesh.pIndexData getIndexCount() -ReturnValueCapacity ovrHmd_Create sizeof(ovrHmd) -ReturnValueCapacity ovrHmd_CreateDebug sizeof(ovrHmd) +ReturnValueCapacity ovrHmd_Create sizeof(ovrHmdDesc) +ReturnValueCapacity ovrHmd_CreateDebug sizeof(ovrHmdDesc) JavaPrologue ovr_Initialize if( !isAvailable() ) { return false; } JavaPrologue ovrHmd_Create if( !isAvailable() ) { return null; } diff --git a/make/config/oculusvr/oculusvr.c b/make/config/oculusvr/oculusvr.c index bab34e5a9..35f86eb78 100644 --- a/make/config/oculusvr/oculusvr.c +++ b/make/config/oculusvr/oculusvr.c @@ -1,4 +1,6 @@ +#define HEADLESS_APP 1 + typedef struct ovrHmdStruct { } OvrHmdContext; diff --git a/make/config/oculusvr/oculusvr.cfg b/make/config/oculusvr/oculusvr.cfg index 11e1ee78b..d2d446f21 100644 --- a/make/config/oculusvr/oculusvr.cfg +++ b/make/config/oculusvr/oculusvr.cfg @@ -12,6 +12,7 @@ IncludeAs CustomJavaCode OVR oculusvr-ovr-CustomJavaCode.java ManualStaticInitCall OVR # Provide #includes to native code +CustomCCode #define HEADLESS_APP 1 CustomCCode typedef struct ovrHmdStruct { CustomCCode } OvrHmdContext; CustomCCode #include <OVR_CAPI.h> diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index 7f25e33b8..0f73de53d 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -79,7 +79,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01 REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWTNoARBCtx $* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $* -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch02AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT %* @@ -221,4 +221,4 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewt REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 -REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %* diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 2d137a0b3..ed9d85896 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -408,12 +408,13 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWTNoARBCtx $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $* # # Stereo # +testnoawt com.jogamp.oculusvr.OVRVersion $* #testnoawt com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 $* # diff --git a/oculusvr-sdk b/oculusvr-sdk -Subproject 633f70342fe270fd91bca8f724049aceec60233 +Subproject 3c7b8a17e907f4ef2afd9f77db566a3f6179cbe diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java index 9be37e193..50e0efd30 100644 --- a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java +++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java @@ -90,6 +90,10 @@ public class OVRVersion extends JogampVersion { if(null == hmdDesc) { throw new IllegalArgumentException("null hmdDesc"); } + final OvrHmdContext hmdCtx = hmdDesc.getHandle(); + if(null == hmdCtx) { + throw new IllegalArgumentException("null hmdCtx"); + } if(null==sb) { sb = new StringBuilder(); } @@ -100,15 +104,16 @@ public class OVRVersion extends JogampVersion { 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.getTrackingCaps()).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".hmdCaps:\t"+toHexString(hmdDesc.getHmdCaps())).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".distorCaps:\t"+toHexString(hmdDesc.getDistortionCaps())).append(Platform.getNewline()); + sb.append("\thmd."+ovrHmdIndex+".sensorCaps:\t"+toHexString(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(); sb.append("\thmd."+ovrHmdIndex+".winPos:\t"+winPos.getX()+" / "+winPos.getY()).append(Platform.getNewline()); return sb; } + private static String toHexString(final int v) { return "0x"+Integer.toHexString(v); } public static StringBuilder getAllAvailableCapabilitiesInfo(StringBuilder sb) { if(null==sb) { diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java index ffe1371a4..21d6cab7b 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java @@ -43,6 +43,10 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory { return false; } + private void dumpCaps(final ovrHmdDesc hmdDesc, final int deviceIndex) { + System.err.println(OVRVersion.getAvailableCapabilitiesInfo(hmdDesc, deviceIndex, null).toString()); + } + @Override public final StereoDevice createDevice(final int deviceIndex, final StereoDeviceConfig config, final boolean verbose) { final ovrHmdDesc hmdDesc = OVR.ovrHmd_Create(deviceIndex); @@ -53,10 +57,16 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory { } return null; } - final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdDesc, deviceIndex); + final int hmdCaps = hmdDesc.getHmdCaps(); + if( 0 == ( hmdCaps & OVR.ovrHmdCap_ExtendDesktop ) ) { + System.err.println("Device "+deviceIndex+" is not in ExtendDesktop mode as required."); + dumpCaps(hmdDesc, deviceIndex); + return null; + } if( verbose ) { - System.err.println(OVRVersion.getAvailableCapabilitiesInfo(ctx.hmdDesc, deviceIndex, null).toString()); + dumpCaps(hmdDesc, deviceIndex); } + final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdDesc, deviceIndex); return ctx; } } diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java index ff15d38d1..60fb8301e 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java @@ -386,6 +386,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { private ShaderProgram sp; private ovrFrameTiming frameTiming; + private int frameCount; @Override public String toString() { @@ -440,6 +441,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { eyes[1] = new OVREye(context.hmdDesc, this.distortionBits, eyePositionOffset, eyeRenderDescs[1], ovrTexture1Size, eyeViewports[1]); sp = null; frameTiming = null; + frameCount = 0; } @Override @@ -550,7 +552,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { @Override public final void beginFrame(final GL gl) { - frameTiming = OVR.ovrHmd_BeginFrameTiming(context.hmdDesc, 0); + frameTiming = OVR.ovrHmd_BeginFrameTiming(context.hmdDesc, 0); // ovrHmd_GetFrameTiming not used, otherwise: frameCount); } @Override @@ -560,6 +562,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer { } OVR.ovrHmd_EndFrameTiming(context.hmdDesc); frameTiming = null; + frameCount++; } @Override diff --git a/src/oculusvr/native/OVRImplMisc.cpp b/src/oculusvr/native/OVRImplMisc.cpp deleted file mode 100644 index 08ebddf62..000000000 --- a/src/oculusvr/native/OVRImplMisc.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "OVR_CAPI.h" - -#include "CAPI_DistortionRenderer.h" - -namespace OVR { namespace CAPI { - - /** - * Index is: apiConfig->Header.API, with - * ovrRenderAPIConfig * apiConfig - * ovrRenderAPIConfigHeader Header - * ovrRenderAPIType Header.API - */ - DistortionRenderer::CreateFunc DistortionRenderer::APICreateRegistry[ovrRenderAPI_Count] = - { - 0, // None - 0, // None for GL - &GL::DistortionRenderer::Create, - 0, // Android_GLES - 0, // D3D9 - 0, // D3D10 - 0 // D3D11 - }; - -}} // namespace OVR::CAPI - -// -// TBD: Replace stdc++ for compatibility ! -// -// This is not enough: -// extern "C" void __cxa_pure_virtual() { while (1); } - |