From 40d7d0d18ed11b8dbb0f16137f82eef828b822a4 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 19 Jun 2014 23:21:19 +0200 Subject: Bug 1021: Add OculusSDK binding / Basic OVR support Bring-up test only initializes the ovrHmdHandle data structure by OVR native code. See com.jogamp.oculusvr.OVRVersion Current evaluation build compiles all OVR-SDK source files itself w/o using provided libovr.a. We also skip the GL dependent renderer of the SDK, i.e. we prefer to utilize our JOGL 'barrel distortion' renderer. This eases the 'chicken-egg' problem of OVR SDK dependencies, i.e. libGL, libGLESv2 .. etc Since the OVR source code is C++, we may still have to figure out how to / and whether we shall link libstdc++ statically to remove platform dependencies. Right now we link libstdc++ statically if using GCC, see make/build-oculusvr.xml (hackish .. TODO: better way to include all symbols). Same consideration applies to GNU/Linux and libudev.so dependency, since there are: - libudev.so.0 and (Older distri's) - libudev.so.1 (Debian8, ..) ... Produced JAR artifacts are - jar/atomic/oculusvr.jar - jar/atomic/oculusvr-natives-.jar i.e. only in 'atomic' variants to not bloat the default 'all' JAR files. .... make/build-oculusvr.xml Notes: - Currently native build only enabled on GNU/Linux (isLinux) - Force disable native build via property 'c.build.oculusvr.skip' --- make/build-common.xml | 41 +- make/build-jogl.xml | 4 +- make/build-nativewindow.xml | 4 - make/build-oculusvr.xml | 671 +++++++++++++++++++++ make/build.xml | 29 +- make/config/oculusvr/oculusvr-common.cfg | 34 ++ .../oculusvr/oculusvr-ovr-CustomJavaCode.java | 22 + make/config/oculusvr/oculusvr.c | 1 + make/config/oculusvr/oculusvr.cfg | 16 + make/oculusvrversion | 19 + make/scripts/tests.sh | 5 +- 11 files changed, 819 insertions(+), 27 deletions(-) create mode 100644 make/build-oculusvr.xml create mode 100644 make/config/oculusvr/oculusvr-common.cfg create mode 100644 make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java create mode 100644 make/config/oculusvr/oculusvr.c create mode 100644 make/config/oculusvr/oculusvr.cfg create mode 100644 make/oculusvrversion (limited to 'make') diff --git a/make/build-common.xml b/make/build-common.xml index c62e269a8..5a6d9c061 100644 --- a/make/build-common.xml +++ b/make/build-common.xml @@ -55,6 +55,7 @@ + @@ -228,9 +229,14 @@ - - - + + + + + + + + @@ -238,11 +244,14 @@ + - + + @@ -410,6 +419,11 @@ + + + + + @@ -492,6 +506,7 @@ + @@ -528,11 +543,12 @@ + - + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${ant-junit4.jar}${path.separator}${semver.jar}${path.separator}${gluegen-rt.jar}${path.separator}${gluegen-test-util.jar}${path.separator}${jogl-all.jar}${path.separator}${oculusvr.jar}${path.separator}${jogl-test.jar}"/> + @@ -544,11 +560,12 @@ + - + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${ant-junit4.jar}${path.separator}${semver.jar}${path.separator}${gluegen-rt.jar}${path.separator}${gluegen-test-util.jar}${path.separator}${jogl-all-noawt.jar}${path.separator}${oculusvr.jar}${path.separator}${jogl-test.jar}"/> + @@ -561,10 +578,11 @@ + + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${ant-junit4.jar}${path.separator}${semver.jar}${path.separator}${gluegen-rt.jar}${path.separator}${gluegen-test-util.jar}${path.separator}${swt.jar}${path.separator}${jogl-all.jar}${path.separator}${oculusvr.jar}${path.separator}${jogl-test.jar}"/> @@ -577,12 +595,13 @@ + + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${ant-junit4.jar}${path.separator}${semver.jar}${path.separator}${gluegen-rt-android.jar}${path.separator}${gluegen-test-util.jar}${path.separator}${jogl-all-android.jar}${path.separator}${oculusvr.jar}${path.separator}${jogl-test.jar}"/> + value="${gluegen.root}/${rootrel.build}/jogamp.android-launcher.apk${path.separator}${ant-junit-all.apk}${path.separator}${gluegen.root}/${rootrel.build}/gluegen-rt-android-${android.abi}.apk${path.separator}${jogl-all-android.apk}${path.separator}${oculusvr.jar}${path.separator}${jogl-test.apk}"/> diff --git a/make/build-jogl.xml b/make/build-jogl.xml index 2e314a9bd..09ca94ab0 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -822,9 +822,7 @@ includes="${java.part.gluegen-gl-rt} ${java.part.gluegen-gl}"/> - - + diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml index b0c49b0d3..bb31dc0d0 100644 --- a/make/build-nativewindow.xml +++ b/make/build-nativewindow.xml @@ -265,10 +265,6 @@ --> - - - diff --git a/make/build-oculusvr.xml b/make/build-oculusvr.xml new file mode 100644 index 000000000..37d06c7d3 --- /dev/null +++ b/make/build-oculusvr.xml @@ -0,0 +1,671 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/make/build.xml b/make/build.xml index a7ba217fb..b356e2a1f 100644 --- a/make/build.xml +++ b/make/build.xml @@ -8,13 +8,13 @@ - Main build target. --> - + - + - + - + @@ -47,10 +47,10 @@ - - - - + + + + @@ -79,12 +79,17 @@ + + + + + @@ -95,6 +100,7 @@ + + @@ -139,6 +146,7 @@ + @@ -148,6 +156,7 @@ + @@ -196,11 +205,15 @@ + + + + diff --git a/make/config/oculusvr/oculusvr-common.cfg b/make/config/oculusvr/oculusvr-common.cfg new file mode 100644 index 000000000..4baa35f0b --- /dev/null +++ b/make/config/oculusvr/oculusvr-common.cfg @@ -0,0 +1,34 @@ +Package com.jogamp.oculusvr + +# Specify output directories +HierarchicalNativeOutput false +JavaOutputDir gensrc/classes +NativeOutputDir gensrc/native/oculusvr + +# Raise OVRException instead of RuntimeException in glue code +RuntimeExceptionType OVRException + +# We also have to hack its return type for now because we can't make +# just that void* opaque +Opaque long ovrHmd + +#ReturnValueCapacity alcOpenDevice 0 + +# Mappings for data types +Opaque boolean ovrBool + +# Not implemented in SDK !? +Ignore ovrHmd_ProcessLatencyTest + +# These routines use or return strings +ReturnsString ovrHmd_GetLastError +ReturnsString ovrHmd_GetLatencyTestResult +ReturnsString ovrHmd_GetString + +ArgumentIsString ovrHmd_GetFloat 1 +ArgumentIsString ovrHmd_SetFloat 1 +ArgumentIsString ovrHmd_GetFloatArray 1 +ArgumentIsString ovrHmd_SetFloatArray 1 +ArgumentIsString ovrHmd_GetArraySize 1 + + diff --git a/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java b/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java new file mode 100644 index 000000000..06f7b3234 --- /dev/null +++ b/make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java @@ -0,0 +1,22 @@ + +static { + AccessController.doPrivileged(new PrivilegedAction() { + public DynamicLibraryBundle run() { + final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new OVRDynamicLibraryBundleInfo()); + if(null==bundle) { + throw new RuntimeException("Null DynamicLibraryBundle"); + } + /** No native tool library to load + if(!bundle.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native OVR library"); + } */ + if(!bundle.isLibComplete()) { + throw new RuntimeException("Couln't load native OVR/JNI glue library"); + } + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } + return bundle; + } } ); +} + diff --git a/make/config/oculusvr/oculusvr.c b/make/config/oculusvr/oculusvr.c new file mode 100644 index 000000000..6d850a380 --- /dev/null +++ b/make/config/oculusvr/oculusvr.c @@ -0,0 +1 @@ +#include "OVR_CAPI.h" diff --git a/make/config/oculusvr/oculusvr.cfg b/make/config/oculusvr/oculusvr.cfg new file mode 100644 index 000000000..aa439772b --- /dev/null +++ b/make/config/oculusvr/oculusvr.cfg @@ -0,0 +1,16 @@ +# This .cfg file is used to generate the JOAL interface. +Include oculusvr-common.cfg + +Style AllStatic +JavaClass OVR + +Import com.jogamp.oculusvr.* +Import java.security.AccessController +Import java.security.PrivilegedAction + +IncludeAs CustomJavaCode OVR oculusvr-ovr-CustomJavaCode.java +ManualStaticInitCall OVR + +# Provide #includes to native code +CustomCCode #include + diff --git a/make/oculusvrversion b/make/oculusvrversion new file mode 100644 index 000000000..dc8912128 --- /dev/null +++ b/make/oculusvrversion @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Application-Name: Java Bindings for OculusVR +Specification-Title: Java Bindings for OculusVR API Specification +Specification-Version: @BASEVERSION@ +Specification-Vendor: JogAmp Community +Implementation-Title: Java Bindings for OculusVR Runtime Environment +Implementation-Version: @VERSION@ +Implementation-Build: @BUILD_VERSION@ +Implementation-Branch: @SCM_BRANCH@ +Implementation-Commit: @SCM_COMMIT@ +Implementation-Vendor: JogAmp Community +Implementation-URL: http://jogamp.org/ +Extension-Name: com.jogamp.oculusvr +Implementation-Vendor-Id: com.jogamp +Trusted-Library: true +Permissions: all-permissions +Application-Library-Allowable-Codebase: * +@JAR_CODEBASE_TAG@ + diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 532bf518b..aa06046df 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -263,6 +263,8 @@ function jrun() { #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false" #X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=false -Dsun.java2d.xrender=false" #X_ARGS="-verbose:jni" + #X_ARGS="-Xcheck:jni" + #X_ARGS="-Xcheck:jni -verbose:jni" #X_ARGS="-Xrs" #X_ARGS="-Dsun.awt.disableMixing=true" #D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer" @@ -350,6 +352,7 @@ function testawtswt() { #testnoawt com.jogamp.nativewindow.NativeWindowVersion $* #testnoawt com.jogamp.opengl.JoglVersion $* #testnoawt com.jogamp.newt.NewtVersion $* +testnoawt com.jogamp.oculusvr.OVRVersion $* #testnoawt com.jogamp.newt.opengl.GLWindow $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* @@ -374,7 +377,7 @@ function testawtswt() { # demos (any TK, more user driven tests) # #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* -- cgit v1.2.3