aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-19 23:21:19 +0200
committerSven Gothel <[email protected]>2014-06-19 23:21:19 +0200
commit40d7d0d18ed11b8dbb0f16137f82eef828b822a4 (patch)
tree954cb10ac50d0eea506c4b4b9dc5b5bac39d99e0
parent20bf51f2ccbecf1ab21ef3dbd2ff06e04ebd40cc (diff)
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-<os.and.arch>.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'
-rw-r--r--.classpath2
-rwxr-xr-xetc/profile.jogl16
-rw-r--r--make/build-common.xml41
-rw-r--r--make/build-jogl.xml4
-rw-r--r--make/build-nativewindow.xml4
-rw-r--r--make/build-oculusvr.xml671
-rw-r--r--make/build.xml29
-rw-r--r--make/config/oculusvr/oculusvr-common.cfg34
-rw-r--r--make/config/oculusvr/oculusvr-ovr-CustomJavaCode.java22
-rw-r--r--make/config/oculusvr/oculusvr.c1
-rw-r--r--make/config/oculusvr/oculusvr.cfg16
-rw-r--r--make/oculusvrversion19
-rw-r--r--make/scripts/tests.sh5
-rw-r--r--src/oculusvr/classes/com/jogamp/oculusvr/OVRDynamicLibraryBundleInfo.java113
-rw-r--r--src/oculusvr/classes/com/jogamp/oculusvr/OVRException.java50
-rw-r--r--src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java107
-rw-r--r--src/oculusvr/native/OVRImplMisc.cpp30
17 files changed, 1130 insertions, 34 deletions
diff --git a/.classpath b/.classpath
index 89c513f23..387c81ba6 100644
--- a/.classpath
+++ b/.classpath
@@ -26,6 +26,8 @@
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="jogl/build/newt/obj"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path="build/oculusvr/gensrc/classes"/>
+ <classpathentry kind="src" path="src/oculusvr/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/gluegen"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Ant"/>
diff --git a/etc/profile.jogl b/etc/profile.jogl
index 16b3a3db0..c898c7082 100755
--- a/etc/profile.jogl
+++ b/etc/profile.jogl
@@ -44,9 +44,11 @@ JOGL_JAR_ALL_NOAWT="jogl-all-noawt.jar"
JOGL_JAR_ALL_MOBILE="jogl-all-mobile.jar"
JOGL_JAR_SWT="atomic/jogl-swt.jar"
-JOGL_LIB_ALL="libnativewindow_x11.so libnativewindow_awt.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so"
-JOGL_LIB_ALL_NOAWT="libnativewindow_x11.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so"
-JOGL_LIB_ALL_MOBILE="libjogl_mobile.so libnewt.so"
+JOGL_JAR_OCULUSVR="atomic/oculusvr.jar"
+
+JOGL_LIB_ALL="libnativewindow_x11.so libnativewindow_awt.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so liboculusvr.so"
+JOGL_LIB_ALL_NOAWT="libnativewindow_x11.so libjogl_desktop.so libjogl_mobile.so libjogl_cg.so libnewt.so liboculusvr.so"
+JOGL_LIB_ALL_MOBILE="libjogl_mobile.so libnewt.so liboculusvr.so"
export JOGL_JAR_ALL JOGL_JAR_ALL_NOAWT JOGL_JAR_ALL_MOBILE
export JOGL_LIB_ALL JOGL_LIB_ALL_NOAWT JOGL_LIB_ALL_MOBILE
@@ -81,10 +83,10 @@ export JOGL_BUILD_DIR
JOGL_LIB_DIR="$JOGL_BUILD_DIR"/lib
export JOGL_LIB_DIR
-JOGL_ALL_AWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL $JOGL_TEST)
-JOGL_ALL_NOAWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL_NOAWT $JOGL_TEST)
-JOGL_MOBILE_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL_MOBILE $JOGL_TEST)
-JOGL_SWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_SWT $JOGL_TEST)
+JOGL_ALL_AWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL $JOGL_JAR_OCULUSVR $JOGL_TEST)
+JOGL_ALL_NOAWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL_NOAWT $JOGL_JAR_OCULUSVR $JOGL_TEST)
+JOGL_MOBILE_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_ALL_MOBILE $JOGL_JAR_OCULUSVR $JOGL_TEST)
+JOGL_SWT_CLASSPATH=$(concat_jogl_list "$JOGL_BUILD_DIR" $JOGL_JAR_SWT $JOGL_JAR_OCULUSVR $JOGL_TEST)
export JOGL_ALL_AWT_CLASSPATH JOGL_ALL_NOAWT_CLASSPATH JOGL_MOBILE_CLASSPATH JOGL_SWT_CLASSPATH
if [ ! -z "$JOGL_PROFILE" ] ; then
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 @@
<property name="src" value="${project.root}/src" />
<property name="lib" value="${build}/lib" />
<property name="jar" value="${build}/jar" />
+ <property name="jar-atomic" value="${build}/jar/atomic" />
<property name="all.srcj.path" value="${src}/nativewindow/classes;${src}/jogl/classes;${src}/newt/classes" />
<!-- No generated classes for Newt at the present time -->
@@ -228,9 +229,14 @@
<property name="build.newt" value="${build}/newt" />
<property name="obj.newt" value="${build.newt}/obj"/>
- <property name="results.test" value="${build}/test/results" />
- <property name="build.test" value="${build}/test/build" />
- <property name="obj.test" value="${build.test}/obj"/>
+ <property name="oculusvr.make" value="." />
+ <property name="oculusvr.build.xml" value="${oculusvr.make}/build-oculusvr.xml" />
+ <property name="build.oculusvr" value="${build}/oculusvr" />
+ <property name="obj.oculusvr" value="${build.oculusvr}/obj"/>
+
+ <property name="results.test" value="${build}/test/results" />
+ <property name="build.test" value="${build}/test/build" />
+ <property name="obj.test" value="${build.test}/obj"/>
<condition property="obj.custom" value="${custom.libdir}${path.separator}" else="">
<isset property="custom.libdir"/>
@@ -238,11 +244,14 @@
<property name="obj.all.paths" value="${obj.custom}${obj.gluegen}${path.separator}${obj.nativewindow}${path.separator}${obj.jogl}${path.separator}${obj.newt}${path.separator}${obj.test}" />
+ <!-- Add the GlueGen task to ANT -->
<path id="gluegen.classpath">
<pathelement location="${gluegen.jar}" />
<pathelement location="${antlr.jar}" />
</path>
-
+ <taskdef name="gluegen" classname="com.jogamp.gluegen.ant.GlueGenTask"
+ classpathref="gluegen.classpath" />
+
<property name="gluegen-gl.jar" value="${build.jogl}/gluegen-gl.jar" />
<path id="gluegen-gl.classpath">
@@ -410,6 +419,11 @@
<pathelement location="${newt-driver-android.jar}" />
</path>
+ <property name="oculusvr.jar" value="${jar-atomic}/oculusvr.jar" />
+ <path id="oculusvr_all_atoms.classpath">
+ <pathelement location="${oculusvr.jar}" />
+ </path>
+
<!-- JavaSE combinations -->
<property name="gluegen-rt.jar" value="${build.gluegen}/gluegen-rt.jar" />
<property name="gluegen-rt-android.jar" value="${build.gluegen}/gluegen-rt-android.jar" />
@@ -492,6 +506,7 @@
<path refid="nativewindow_all_atoms.classpath" />
<path refid="jogl_all_atoms.classpath" />
<path refid="newt_all_atoms.classpath" />
+ <path refid="oculusvr_all_atoms.classpath"/>
</path>
<path id="junit_jogl_newt_android.compile.classpath">
@@ -528,11 +543,12 @@
<pathelement location="${gluegen-rt.jar}" />
<pathelement location="${gluegen-test-util.jar}" />
<pathelement location="${jogl-all.jar}" />
+ <pathelement location="${oculusvr.jar}" />
<pathelement location="${jogl-test.jar}" />
</path>
<property name="junit_jogl_awt.run.jars"
- 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}${jogl-test.jar}"/>
- <property name="junit_jogl_awt.run.remote.jars" value="${junit.jar}${path.separator}${env.TARGET_ANT_HOME}/lib/ant.jar${path.separator}${env.TARGET_ANT_HOME}/lib/ant-junit.jar${path.separator}${env.TARGET_ANT_HOME}/lib/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}${jogl-test.jar}"/>
+ 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}"/>
+ <property name="junit_jogl_awt.run.remote.jars" value="${junit.jar}${path.separator}${env.TARGET_ANT_HOME}/lib/ant.jar${path.separator}${env.TARGET_ANT_HOME}/lib/ant-junit.jar${path.separator}${env.TARGET_ANT_HOME}/lib/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}"/>
<!-- Test Run w/o AWT .. -->
<path id="junit_jogl_noawt.run.classpath">
@@ -544,11 +560,12 @@
<pathelement location="${gluegen-rt.jar}" />
<pathelement location="${gluegen-test-util.jar}" />
<pathelement location="${jogl-all-noawt.jar}" />
+ <pathelement location="${oculusvr.jar}" />
<pathelement location="${jogl-test.jar}" />
</path>
<property name="junit_jogl_noawt.run.jars"
- 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}${jogl-test.jar}"/>
- <property name="junit_jogl_noawt.run.remote.jars" value="${junit.jar}${path.separator}${env.TARGET_ANT_HOME}/lib/ant.jar${path.separator}${env.TARGET_ANT_HOME}/lib/ant-junit.jar${path.separator}${env.TARGET_ANT_HOME}/lib/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}${jogl-test.jar}"/>
+ 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}"/>
+ <property name="junit_jogl_noawt.run.remote.jars" value="${junit.jar}${path.separator}${env.TARGET_ANT_HOME}/lib/ant.jar${path.separator}${env.TARGET_ANT_HOME}/lib/ant-junit.jar${path.separator}${env.TARGET_ANT_HOME}/lib/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}"/>
<!-- Test Run w/ SWT .. -->
<path id="junit_jogl_swt.run.classpath">
@@ -561,10 +578,11 @@
<pathelement location="${gluegen-test-util.jar}" />
<pathelement location="${swt.jar}" />
<pathelement location="${jogl-all.jar}" />
+ <pathelement location="${oculusvr.jar}" />
<pathelement location="${jogl-test.jar}" />
</path>
<property name="junit_jogl_swt.run.jars"
- 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}${jogl-test.jar}"/>
+ 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}"/>
<!-- Test Run w/ Android [w/o AWT] .. -->
<path id="junit_jogl_android.run.classpath">
@@ -577,12 +595,13 @@
<pathelement location="${gluegen-rt-android.jar}" />
<pathelement location="${gluegen-test-util.jar}" />
<pathelement location="${jogl-all-android.jar}" />
+ <pathelement location="${oculusvr.jar}" />
<pathelement location="${jogl-test.jar}" />
</path>
<property name="junit_jogl_android.run.jars"
- 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}${jogl-test.jar}"/>
+ 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}"/>
<property name="junit.run.remote.apks"
- 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}${jogl-test.apk}"/>
+ 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}"/>
<!-- Dummy extra CLASSPATH value, maybe overwritten -->
<property name="junit_extra_classpath" value=""/>
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}"/>
</jar>
- <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT -->
- <taskdef name="gluegen" classname="com.jogamp.gluegen.ant.GlueGenTask"
- classpathref="gluegen.classpath" />
+ <!-- Add the BuildStaticGLInfo tasks to ANT -->
<taskdef name="staticglgen" classname="com.jogamp.gluegen.opengl.ant.StaticGLGenTask"
classpathref="gluegen-gl.classpath" />
</target>
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 @@
-->
<target name="java.generate" depends="init, common.gluegen.build, java.generate.check" unless="java.generate.skip">
- <!-- Add the GlueGen task to ANT -->
- <taskdef name="gluegen" classname="com.jogamp.gluegen.ant.GlueGenTask"
- classpathref="gluegen.classpath" />
-
<!-- Use the GlueGen task to generate the Java files -->
<antcall target="java.generate.cleantemp" inheritRefs="true" />
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -->
+<project name="OculusVR" basedir="." default="all">
+
+ <import file="build-common.xml"/>
+
+ <!-- needed for outofdate task -->
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath> <pathelement location="${ant-contrib.jar}"/> </classpath>
+ </taskdef>
+
+ <!-- ================================================================== -->
+ <!--
+ - Base initialization and detection of operating system.
+ -->
+ <target name="partitioning.setup" depends="common.init">
+ <property name="java.part.oculusvr"
+ value="com/jogamp/oculusvr/** jogamp/oculusvr/**"/>
+ <property name="java.part.oculusvr.exclude"
+ value="" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Declare all paths and user defined variables.
+ -->
+ <target name="init" depends="declare.common">
+ <!-- Create the required output directories. -->
+ <mkdir dir="${src.generated.java}" />
+ <mkdir dir="${src.generated.c}" />
+ <mkdir dir="${classes}" />
+ <mkdir dir="${obj.oculusvr}" />
+ <mkdir dir="${obj.oculusvrsub}" />
+ </target>
+
+ <target name="declare.common" description="Declare properties" depends="partitioning.setup">
+ <property name="config.oculusvr" value="${config}/oculusvr" />
+
+ <property name="rootrel.src.java" value="src/oculusvr/classes" />
+ <property name="rootrel.src.c" value="src/oculusvr/native" />
+
+ <property name="rootrel.src.generated" value="${rootrel.build}/oculusvr/gensrc" />
+ <property name="rootrel.generated.c" value="${rootrel.src.generated}/native/oculusvr" />
+
+ <property name="rootrel.oculusvr.sdk" value="oculusvr-sdk"/>
+ <property name="rel.oculusvr.sdk" value="${project.root}/${rootrel.oculusvr.sdk}"/>
+
+ <!-- The source directories. -->
+ <property name="src.java" value="${project.root}/${rootrel.src.java}" />
+ <property name="src.c" value="${project.root}/${rootrel.src.c}" />
+
+ <!-- The generated source directories. -->
+ <property name="src.generated" value="${build.oculusvr}/gensrc" />
+ <property name="src.generated.java" value="${src.generated}/classes" />
+ <property name="src.generated.c" value="${src.generated}/native/oculusvr" />
+
+ <!-- The compiler output directories. -->
+ <property name="classes" value="${build.oculusvr}/classes" />
+ <property name="obj.oculusvrsub" value="${obj.oculusvr}" />
+
+ <!-- The OculusVR headers from which Java files are generated -->
+ <property name="stub.includes.ovr" value="${rel.oculusvr.sdk}/LibOVR/Src" />
+ <property name="stub.includes.all.ovr" value="${stub.includes.ovr},${stub.includes.ovr}/CAPI" />
+
+ <echo message="rel.oculusvr.sdk ${rel.oculusvr.sdk}" />
+ <echo message="stub.includes.ovr ${stub.includes.ovr}" />
+ <echo message="stub.includes.all.ovr ${stub.includes.all.ovr}"/>
+
+ <fileset id="stub.includes.dependencies.fileset.1" dir="${stub.includes.ovr}">
+ <include name="**" />
+ </fileset>
+ <!-- echo message="stub.includes.dependencies.fileset.1 ${toString:stub.includes.dependencies.fileset.1}"/ -->
+ <fileset id="stub.includes.dependencies.fileset.2" file="${gluegen.jar}" />
+ <fileset id="stub.includes.dependencies.fileset.3" dir="${config.oculusvr}">
+ <include name="*.cfg" />
+ <include name="*.java" />
+ <include name="*.c" />
+ </fileset>
+
+ <!-- The javadoc dirs. -->
+ <property name="javadoc" value="${project.root}/javadoc_oculusvr" />
+ <property name="javadoc.windowtitle" value="OculusVR API Specification -- Version ${jogamp.version.base}" />
+ <property name="javadoc.overview" value="doc/oculusvr/spec-overview.html" />
+ <property name="javadoc.packagenames" value="com.jogamp.oculusvr.*" />
+
+ <property name="javadoc.dev.packagenames" value="${javadoc.packagenames},jogamp.opengl.*,com.jogamp.gluegen,com.jogamp.gluegen.runtime" />
+
+ <condition property="c.build.supported">
+ <and>
+ <or>
+ <isset property="isLinuxX86"/>
+ <isset property="isLinuxAMD64"/>
+ <!-- isset property="isAndroid"/-->
+ <!-- isset property="isWindowsX86"/-->
+ <!-- isset property="isWindowsAMD64"/-->
+ <!-- isset property="isOSX"/-->
+ </or>
+ <not>
+ <isset property="c.build.oculusvr.skip"/>
+ </not>
+ </and>
+ </condition>
+ <echo message="c.build.supported ${c.build.supported}" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Check to see whether we need to rebuild the generated sources.
+ -->
+ <target name="java.generate.check">
+ <!-- Blow away all target files if any dependencies are violated
+ (the uptodate task doesn't allow arbitrary source and target filesets but should) -->
+ <!--
+ <dependset>
+ <srcfileset refid="stub.includes.dependencies.fileset.1" />
+ <srcfileset refid="stub.includes.dependencies.fileset.2" />
+ <srcfileset refid="stub.includes.dependencies.fileset.3" />
+ <targetfileset dir="${src.generated}">
+ <include name="**/*.java" />
+ <include name="**/*.c" />
+ </targetfileset>
+ </dependset>
+ -->
+
+ <!-- Now check for the presence of one well-known file -->
+ <uptodate property="java.generate.skip.ovr"
+ targetfile="${src.generated.java}/com/jogamp/oculusvr/OVR.java">
+ <srcfiles refid="stub.includes.dependencies.fileset.1" />
+ <srcfiles refid="stub.includes.dependencies.fileset.2" />
+ <srcfiles refid="stub.includes.dependencies.fileset.3" />
+ </uptodate>
+
+ <condition property="java.generate.skip">
+ <and>
+ <isset property="java.generate.skip.ovr"/>
+ </and>
+ </condition>
+
+ <!--property name="java.generate.skip" value="true"/-->
+ </target>
+
+ <target name="java.generate" depends="init, common.gluegen.build, java.generate.check" unless="java.generate.skip">
+ <echo message="Generating OVR" />
+ <gluegen src="${config.oculusvr}/oculusvr.c"
+ outputRootDir="${build.oculusvr}"
+ config="${config.oculusvr}/oculusvr.cfg"
+ literalInclude="${stub.includes.gluegen.gg},${stub.includes.all.ovr}"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ debug="false"
+ dumpCPP="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+ <!--
+ emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"
+ -->
+ </target>
+
+ <!-- ================================================================== -->
+
+ <target name="java.compile" depends="java.generate">
+ <!-- Perform the second pass Java compile; everything except portion of fixed function emulation depending on generated code. -->
+ <javac destdir="${classes}"
+ fork="yes"
+ includeAntRuntime="false"
+ memoryMaximumSize="${javac.memorymax}"
+ encoding="UTF-8"
+ source="${target.sourcelevel}"
+ target="${target.targetlevel}"
+ bootclasspath="${target.rt.jar}"
+ debug="${javacdebug}" debuglevel="${javacdebuglevel}">
+ <classpath refid="nativewindow_gluegen.classpath"/>
+ <src path="${src.java}" />
+ <src path="${src.generated.java}" />
+ </javac>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Compile the native C code for OculusVR
+ -->
+
+ <target name="c.configure.1" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler">
+ <!-- compiler configuration -->
+ <!-- Note that we can use the base setups in the gluegen-cpptasks for most of these -->
+
+ <compiler id="compiler.cfg.freebsd.oculusvr" extends="compiler.cfg.freebsd">
+ <!-- Need to force X11R6 headers on to include path after stub_includes -->
+ <includepath path="/usr/local/include" />
+ </compiler>
+
+ <compiler id="compiler.cfg.linux.armv6.oculusvr.x11" extends="compiler.cfg.linux.armv6">
+ <!-- Need to force /usr/include headers on to include path (after all others), due to crosscompiler usage -->
+ <compilerarg value="-idirafter" />
+ <compilerarg value="/usr/include" />
+ </compiler>
+
+ <!-- linker configuration -->
+
+ <linker id="linker.cfg.freebsd.oculusvr.x11" extends="linker.cfg.freebsd">
+ <syslibset dir="/usr/local/lib" libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.freebsd.amd64.oculusvr.x11" extends="linker.cfg.freebsd.amd64">
+ <syslibset dir="/usr/local/lib" libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.linux.oculusvr.x11" extends="linker.cfg.linux">
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.linux.x86.oculusvr.x11" extends="linker.cfg.linux.x86">
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.linux.amd64.oculusvr.x11" extends="linker.cfg.linux.amd64">
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.linux.armv6.oculusvr.x11" extends="linker.cfg.linux.armv6">
+ <syslibset dir="${env.TARGET_PLATFORM_ROOT}/usr/lib" libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.android.oculusvr" extends="linker.cfg.android">
+ </linker>
+
+ <linker id="linker.cfg.solaris.oculusvr.x11" extends="linker.cfg.solaris">
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.solaris.sparcv9.oculusvr.x11" extends="linker.cfg.solaris.sparcv9">
+ <linkerarg value="-L/usr/lib/sparcv9"/>
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.solaris.amd64.oculusvr.x11" extends="linker.cfg.solaris.amd64">
+ <linkerarg value="-L/usr/lib/amd64"/>
+ <syslibset libs="X11 Xrandr udev m"/>
+ </linker>
+
+ <linker id="linker.cfg.win32.mingw.oculusvr" extends="linker.cfg.win32.mingw">
+ <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
+ <syslibset libs="gdi32, kernel32, strmiids, uuid, ole32, oleaut32"/> <!-- last 4 for dshow video input query! -->
+ </linker>
+
+ <linker id="linker.cfg.win64.mingw.oculusvr" extends="linker.cfg.win64.mingw">
+ <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
+ <syslibset libs="gdi32, kernel32, strmiids, uuid, ole32, oleaut32"/> <!-- last 4 for dshow video input query! -->
+ </linker>
+
+ <linker id="linker.cfg.win32.msvc.oculusvr" extends="linker.cfg.win32.msvc">
+ <syslibset libs="user32, kernel32" />
+ <!-- This is temporary -->
+ <syslibset libs="winmm" />
+ </linker>
+
+ <linker id="linker.cfg.macosx.oculusvr" extends="linker.cfg.macosx">
+ <linkerarg value="-weak_framework" />
+ <linkerarg value="AppKit" />
+ <linkerarg value="-weak_framework" />
+ <linkerarg value="QuartzCore" />
+ <linkerarg value="-weak_framework" />
+ <linkerarg value="Cocoa" />
+ <!--linkerarg value="-weak_framework" />
+ <linkerarg value="OpenGL" /-->
+ </linker>
+
+ <linker id="linker.cfg.hpux.oculusvr" extends="linker.cfg.hpux">
+ <!-- syslibset dir="/opt/graphics/OpenGL/lib" libs="GL, GLU"/-->
+ <syslibset dir="/usr/lib" libs="X11 Xrandr udev m"/>
+ </linker>
+ </target>
+
+ <target name="c.configure.win32.vc" if="isVCFamily">
+ <echo message="Win32.VC" />
+ <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" />
+ <property name="linker.cfg.id.os" value="linker.cfg.win32.msvc.oculusvr" />
+ </target>
+
+ <target name="c.configure.win32.mingw" if="isMingW32">
+ <echo message="Win32.MingW" />
+ <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" />
+ <property name="linker.cfg.id.os" value="linker.cfg.win32.mingw.oculusvr" />
+ </target>
+
+ <target name="c.configure.win64.mingw" if="isMingW64">
+ <echo message="Win64.MingW" />
+ <property name="compiler.cfg.id" value="compiler.cfg.win64.mingw" />
+ <property name="linker.cfg.id.os" value="linker.cfg.win64.mingw.oculusvr" />
+ </target>
+
+ <target name="c.configure.linux.x86" if="isLinuxX86">
+ <echo message="Linux.x86" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux.x86" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.x86.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.amd64" if="isLinuxAMD64">
+ <echo message="Linux.AMD64" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.amd64.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.armv6" if="isLinuxARMv6">
+ <echo message="Linux.armv6" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux.armv6.oculusvr.x11" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.armv6.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.ia64" if="isLinuxIA64">
+ <echo message="Linux.IA64" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.hppa" if="isLinuxHppa">
+ <echo message="Linux.HPPA" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.mips" if="isLinuxMips">
+ <echo message="Linux.MIPS" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
+ <echo message="Linux.MIPSEL" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.ppc" if="isLinuxPpc">
+ <echo message="Linux.PPC" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.s390" if="isLinuxs390">
+ <echo message="Linux.S390" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux.sparc" if="isLinuxSparc">
+ <echo message="Linux.SPARC" />
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.linux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.linux" depends="c.configure.linux.armv6,c.configure.linux.x86,c.configure.linux.amd64,c.configure.linux.ia64,c.configure.linux.hppa,c.configure.linux.mips,c.configure.linux.mipsel,c.configure.linux.ppc,c.configure.linux.s390,c.configure.linux.sparc,c.configure.x11" if="isLinux" />
+
+ <target name="c.configure.android" if="isAndroid">
+ <echo message="Android" />
+ <property name="compiler.cfg.id" value="compiler.cfg.android" />
+ <property name="linker.cfg.id.os" value="linker.cfg.android.oculusvr" />
+ </target>
+
+ <target name="c.configure.solaris32" depends="c.configure.x11" if="isSolaris32Bit">
+ <echo message="Solaris" />
+ <property name="compiler.cfg.id" value="compiler.cfg.solaris" />
+ <property name="linker.cfg.id.os" value="linker.cfg.solaris.oculusvr.x11" />
+ </target>
+
+
+ <target name="c.configure.solaris.sparcv9" depends="c.configure.x11" if="isSolarisSparcv9">
+ <echo message="SolarisSparcv9" />
+ <property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" />
+ <property name="linker.cfg.id.os" value="linker.cfg.solaris.sparcv9.oculusvr.x11" />
+ </target>
+
+
+ <target name="c.configure.solaris.amd64" depends="c.configure.x11" if="isSolarisAMD64">
+ <echo message="SolarisAMD64" />
+ <property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" />
+ <property name="linker.cfg.id.os" value="linker.cfg.solaris.amd64.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.freebsd.x86" depends="c.configure.x11" if="isFreeBSDX86">
+ <echo message="FreeBSD" />
+ <property name="compiler.cfg.id" value="compiler.cfg.freebsd.oculusvr" />
+ <property name="linker.cfg.id.os" value="linker.cfg.freebsd.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.freebsd.amd64" depends="c.configure.x11" if="isFreeBSDAMD64">
+ <echo message="FreeBSD" />
+ <property name="compiler.cfg.id" value="compiler.cfg.freebsd.oculusvr" />
+ <property name="linker.cfg.id.os" value="linker.cfg.freebsd.amd64.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.freebsd" depends="c.configure.freebsd.x86,c.configure.freebsd.amd64,c.configure.x11" if="isFreeBSD" />
+
+ <target name="c.configure.hpux" depends="c.configure.x11" if="isHPUX">
+ <echo message="HP-UX" />
+ <property name="compiler.cfg.id" value="compiler.cfg.hpux" />
+ <property name="linker.cfg.id.os" value="linker.cfg.hpux.oculusvr.x11" />
+ </target>
+
+ <target name="c.configure.win32" depends="c.configure.win32.vc,c.configure.win32.mingw,c.configure.win64.mingw" if="isWindows" />
+
+ <target name="c.configure.x11" if="isX11" />
+
+ <target name="c.configure.macosx" if="isOSX">
+ <property name="compiler.cfg.id" value="compiler.cfg.macosx" />
+ <property name="linker.cfg.id.os" value="linker.cfg.macosx.oculusvr" />
+ </target>
+
+ <target name="c.configure.2" depends="c.configure.win32,c.configure.linux,c.configure.android,c.configure.solaris32,c.configure.solaris.sparcv9,c.configure.solaris.amd64,c.configure.macosx,c.configure.freebsd,c.configure.hpux" />
+
+ <target name="c.configure" depends="c.configure.1,c.configure.2" />
+
+ <target name="rename.mingw.dll" if="isMingW">
+ <move file="${src}" tofile="${dest}" />
+ </target>
+
+ <target name="rename.dylib" if="isOSX">
+ <move file="${src}" tofile="${dest}" />
+ </target>
+
+ <macrodef name="c.build">
+ <attribute name="c.compiler.src.files" />
+ <attribute name="compiler.cfg.id" />
+ <attribute name="linker.cfg.id" />
+ <attribute name="output.lib.name" />
+ <attribute name="c.compiler.use-jawt" default="false"/>
+ <sequential>
+ <echo message="Output lib name = @{output.lib.name}" />
+
+ <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
+
+ <patternset id="c.src.files.oculusvr">
+ <!--
+ $ g++ -print-file-name=libstdc++.a
+ /usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.a
+ <include name="/usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.a"/>
+ -->
+ <include name="${rootrel.generated.c}/OVR_JNI.c"/>
+ <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/GL/CAPI_GL_DistortionRenderer.cpp"/-->
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_Util.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/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_Linux_SensorDevice.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_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_File.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_FileFILE.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_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_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_Render_Stereo.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_HIDDevice.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_SensorDevice.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_DeviceManager.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_HMDDevice.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/3rdParty/TinyXml/tinyxml2.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/3rdParty/EDID/edid.cpp"/>
+ </patternset>
+
+ <echo message="Compiling @{output.lib.name}" />
+
+ <!-- have to wrap cc task with outofdate, because otherwise cc links a new library
+ even when no files have been compiled -->
+ <outofdate>
+ <sourcefiles>
+ <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
+ </sourcefiles>
+ <targetfiles>
+ <fileset dir="${obj.oculusvr}" includes="lib@{output.lib.name}.so"/>
+ <fileset dir="${obj.oculusvr}" includes="@{output.lib.name}.dll"/>
+ <fileset dir="${obj.oculusvr}" includes="lib@{output.lib.name}.jnilib"/>
+ </targetfiles>
+ <sequential>
+ <cc outtype="shared"
+ objdir="${obj.oculusvrsub}"
+ outfile="${obj.oculusvr}/@{output.lib.name}"
+ optimize="${c.compiler.optimise}"
+ debug="${c.compiler.debug}"
+ multithreaded="true"
+ exceptions="false"
+ rtti="false">
+
+ <fileset dir="${project.root}">
+ <patternset refid="@{c.compiler.src.files}"/>
+ </fileset>
+
+ <compiler extends="@{compiler.cfg.id}" >
+ <sysincludepath path="${java.includes.dir}"/>
+ <sysincludepath path="${java.includes.dir.platform}"/>
+ <sysincludepath path="${stub.includes.gluegen.cc}"/>
+ <includepath path="${stub.includes.ovr}"/>
+ <includepath path="${stub.includes.ovr}/CAPI"/>
+
+ <!-- This is for the generated headers for handwritten C code -->
+ <includepath path="${src.c}"/>
+ <includepath path="${src.generated.c}" />
+
+ <compilerarg value="-fno-rtti"/>
+ </compiler>
+
+ <linker extends="@{linker.cfg.id}">
+ <linkerarg value="-Wl,-Bstatic" if="isGCC"/>
+ <!-- linkerarg value="-Wl,-whole-archive" if="isGCC"/-->
+ <linkerarg value="-Wl,--undefined=__cxa_pure_virtual" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=__cxa_guard_release" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=__cxa_guard_abort" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=__cxa_guard_acquire" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=__gxx_personality_v0" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=_ZdaPv" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=_Znwm" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=_Znam" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=_Znaj" if="isGCC"/>
+ <linkerarg value="-Wl,--undefined=_Znwj" if="isGCC"/>
+ <linkerarg value="-lstdc++" />
+ <!-- linkerarg value="-Wl,-no-whole-archive" if="isGCC"/-->
+ <linkerarg value="-Wl,-Bdynamic" if="isGCC"/>
+ <!-- syslibset libs="stdc++"/ -->
+ </linker>
+ </cc>
+
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from dylib to jnilib -->
+ <antcall target="rename.dylib" inheritRefs="true">
+ <param name="src" value="${obj.oculusvr}/lib@{output.lib.name}.dylib" />
+ <param name="dest" value="${obj.oculusvr}/lib@{output.lib.name}.jnilib" />
+ </antcall>
+
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from dylib to jnilib -->
+ <antcall target="rename.mingw.dll" inheritRefs="true">
+ <param name="src" value="${obj.oculusvr}/lib@{output.lib.name}.so" />
+ <param name="dest" value="${obj.oculusvr}/@{output.lib.name}.dll" />
+ </antcall>
+
+ <!-- this stripping may be called more than once on the same library dir,
+ but that should cause no harm, and doing it here inside outofdate
+ prevents the JARs from always being rebuilt even if no source code changes -->
+ <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true">
+ <param name="libdir" value="${obj.oculusvr}"/>
+ </antcall>
+
+ </sequential>
+ </outofdate>
+ </sequential>
+ </macrodef>
+
+ <target name="c.build" depends="c.configure" if="c.build.supported">
+ <c.build c.compiler.src.files="c.src.files.oculusvr"
+ output.lib.name="oculusvr"
+ compiler.cfg.id="${compiler.cfg.id}"
+ linker.cfg.id="${linker.cfg.id.os}"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the oculusvr.jar files.
+ -->
+ <target name="build-jars-dependset" depends="init,gluegen.cpptasks.detect.os" >
+ <dependset>
+ <srcfileset dir="${src.java}"/>
+ <targetfileset dir="." includes="${build.oculusvr}/oculusvr.jar" />
+ </dependset>
+ </target>
+ <target name="build-jars" depends="build-jars-dependset,build-jars-javase" />
+
+ <target name="setup-manifestfile" depends="common.init">
+ <property name="manifestfile" value="oculusvrversion"/>
+ <copy file="${manifestfile}"
+ tofile="${build.oculusvr}/manifest.mf"
+ overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${jogamp.version}"/>
+ <filter token="BUILD_VERSION" value="${jogl.version}"/>
+ <filter token="SCM_BRANCH" value="${jogl.build.branch}"/>
+ <filter token="SCM_COMMIT" value="${jogl.build.commit}"/>
+ <filter token="BASEVERSION" value="${jogamp.version.base}"/>
+ <filter token="JAR_CODEBASE_TAG" value="${jogamp.jar.codebase}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <target name="build-jars-javase" depends="setup-manifestfile">
+ <jar manifest="${build.oculusvr}/manifest.mf" destfile="${build.oculusvr}/oculusvr.jar" filesonly="true">
+ <fileset dir="${classes}"
+ includes="${java.part.oculusvr}"
+ excludes="${java.part.oculusvr.exclude}"/>
+ </jar>
+ <jar manifest="${build.oculusvr}/manifest.mf" destfile="${build.oculusvr}/oculusvr-natives-${os.and.arch}.jar" filesonly="true">
+ <fileset dir="${obj.oculusvr}">
+ <include name="*oculusvr.${native.library.suffix}" />
+ </fileset>
+ </jar>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the Javadocs for the sources.
+ - NOTE: these are not entirely correct as the javadocs targets depend
+ - on the platform specific build targets. To circumvent any
+ - errors, ensure that the source is built first.
+ -->
+ <target name="javadoc" depends="init">
+ <javadoc packagenames="${javadoc.packagenames}"
+ sourcepath="${src.java};${src.generated.java}"
+ destdir="${javadoc}" windowtitle="${javadoc.windowtitle}"
+ overview="${javadoc.overview}"
+ encoding="UTF-8"
+ source="${target.sourcelevel}"
+ maxmemory="${javac.memorymax}"
+ linkoffline="${javadoc.link} 142-packages"
+ bottom="" >
+ <classpath refid="nativewindow_gluegen.classpath"/>
+ <taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.jar}" />
+ </javadoc>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Clean up all that is built.
+ -->
+ <target name="clean" description="Remove all build products" depends="declare.common">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${build.oculusvr}" />
+ <fileset dir="${javadoc}" />
+ </delete>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build everything.
+ -->
+ <target name="all" description="Build OculusVR JAR file(s) and native libraries." depends="init,java.compile,c.build,build-jars,generate.version.txt" />
+
+ <target name="generate.version.txt" depends="init">
+ <!-- Create a version.txt file indicating which version we just built -->
+ <echo message="${oculusvr.version}" file="${build.oculusvr}/version.txt" />
+ </target>
+
+</project>
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.
-->
- <target name="all" description="Build nativewindow, jogl and newt projects, incl. all junit tests " depends="init,build.nativewindow,build.jogl,build.newt,one.dir,tag.build,test.compile,developer-zip-archive" />
+ <target name="all" description="Build nativewindow, jogl and newt projects, incl. all junit tests " depends="init,build.nativewindow,build.jogl,build.newt,build.oculusvr,one.dir,tag.build,test.compile,developer-zip-archive" />
- <target name="all.debug" description="Debug build nativewindow, jogl and newt projects, incl. all junit tests " depends="init.debug,build.nativewindow,build.jogl,build.newt,one.dir,tag.build,test.compile,developer-zip-archive" />
+ <target name="all.debug" description="Debug build nativewindow, jogl and newt projects, incl. all junit tests " depends="init.debug,build.nativewindow,build.jogl,build.newt,build.oculusvr,one.dir,tag.build,test.compile,developer-zip-archive" />
- <target name="all.but-archives" description="Build nativewindow, jogl and newt projects, incl. all junit tests " depends="init,build.nativewindow,build.jogl,build.newt,one.dir,tag.build,test.compile" />
+ <target name="all.but-archives" description="Build nativewindow, jogl and newt projects, incl. all junit tests " depends="init,build.nativewindow,build.jogl,build.newt,build.oculusvr,one.dir,tag.build,test.compile" />
- <target name="all.ide" description="Debug IDE build nativewindow, jogl and newt projects, including all junit tests, but don't tag the build or create archives" depends="init.debug,build.nativewindow,build.jogl,build.newt,one.dir,test.compile" />
+ <target name="all.ide" description="Debug IDE build nativewindow, jogl and newt projects, including all junit tests, but don't tag the build or create archives" depends="init.debug,build.nativewindow,build.jogl,build.newt,build.oculusvr,one.dir,test.compile" />
<target name="test.compile">
<ant antfile="build-test.xml" target="test.compile" inheritRefs="true" inheritAll="true"/>
@@ -47,10 +47,10 @@
<target name="clean" depends="init">
<ant antfile="${nativewindow.build.xml}" dir="${nativewindow.make}" target="clean" inheritRefs="true" inheritAll="true"/>
- <ant antfile="${jogl.build.xml}" dir="${jogl.make}" target="clean" inheritRefs="true" inheritAll="true"/>
- <ant antfile="${newt.build.xml}" dir="${newt.make}" target="clean" inheritRefs="true" inheritAll="true"/>
- <ant antfile="${newt.build.xml}" dir="${newt.make}" target="clean" inheritRefs="true" inheritAll="true"/>
- <ant antfile="build-test.xml" target="clean" inheritRefs="true" inheritAll="true"/>
+ <ant antfile="${jogl.build.xml}" dir="${jogl.make}" target="clean" inheritRefs="true" inheritAll="true"/>
+ <ant antfile="${newt.build.xml}" dir="${newt.make}" target="clean" inheritRefs="true" inheritAll="true"/>
+ <ant antfile="${oculusvr.build.xml}" dir="${oculusvr.make}" target="clean" inheritRefs="true" inheritAll="true"/>
+ <ant antfile="build-test.xml" target="clean" inheritRefs="true" inheritAll="true"/>
<delete includeEmptyDirs="true" quiet="true" failonerror="false">
<fileset dir="${build}" />
<fileset dir="." includes="*.tga" />
@@ -79,12 +79,17 @@
<ant antfile="${newt.build.xml}" dir="${newt.make}" target="all" inheritRefs="true" inheritAll="true"/>
</target>
+ <target name="build.oculusvr" depends="init">
+ <ant antfile="${oculusvr.build.xml}" dir="${oculusvr.make}" target="all" inheritRefs="true" inheritAll="true"/>
+ </target>
+
<target name="one.lib.dir" depends="init,gluegen.cpptasks.detect.os" unless="one.dir.skip">
<mkdir dir="${lib}" />
<copy todir="${lib}">
<fileset dir="${build}/jogl/obj" includes="*.${native.library.suffix}" />
<fileset dir="${build}/nativewindow/obj" includes="*.${native.library.suffix}" />
<fileset dir="${build}/newt/obj" includes="*.${native.library.suffix}" />
+ <!-- fileset dir="${build}/oculusvr/obj" includes="*.${native.library.suffix}" /-->
</copy>
</target>
@@ -95,6 +100,7 @@
<fileset dir="${build.jogl}" includes="*.jar" />
<fileset dir="${build.nativewindow}" includes="*.jar" />
<fileset dir="${build.newt}" includes="*.jar" />
+ <fileset dir="${build.oculusvr}" includes="*.jar" />
</copy>
<copy file="joglversion-all"
@@ -130,6 +136,7 @@
<path refid="nativewindow_all_atoms.classpath"/>
<path refid="jogl_all_atoms.classpath"/>
<path refid="newt_all_atoms.classpath"/>
+ <!-- path refid="oculusvr_all_atoms.classpath"/-->
</zips>
</archives>
</jar>
@@ -139,6 +146,7 @@
<path refid="nativewindow_all-noawt_atoms.classpath"/>
<path refid="jogl_all-noawt_atoms.classpath"/>
<path refid="newt_all-noawt_atoms.classpath"/>
+ <!-- path refid="oculusvr_all_atoms.classpath"/-->
</zips>
</archives>
</jar>
@@ -148,6 +156,7 @@
<path refid="nativewindow_all-noawt_atoms.classpath"/>
<path refid="jogl_all-mobile_atoms.classpath"/>
<path refid="newt_all-mobile_atoms.classpath"/>
+ <!-- path refid="oculusvr_all_atoms.classpath"/-->
</zips>
</archives>
</jar>
@@ -196,11 +205,15 @@
<srcfiles dir="${build.jogl}" includes="*.jar"/>
<srcfiles dir="${build.newt}" includes="*.jar"/>
</uptodate>
+ <uptodate property="one.dir.skip.oculusvr" targetfile="${oculusvr.jar}">
+ <srcfiles dir="${build.oculusvr}" includes="*.jar"/>
+ </uptodate>
<condition property="one.dir.skip">
<and>
<isset property="one.dir.skip.native"/>
<isset property="one.dir.skip.all"/>
<isset property="one.dir.skip.android"/>
+ <isset property="one.dir.skip.oculusvr"/>
</and>
</condition>
</target>
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<DynamicLibraryBundle>() {
+ 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 <OVR_CAPI.h>
+
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 $*
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRDynamicLibraryBundleInfo.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRDynamicLibraryBundleInfo.java
new file mode 100644
index 000000000..6bd9d1a64
--- /dev/null
+++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRDynamicLibraryBundleInfo.java
@@ -0,0 +1,113 @@
+/**
+ * Copyright 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.oculusvr;
+
+import com.jogamp.common.jvm.JNILibLoaderBase;
+import com.jogamp.common.os.DynamicLibraryBundle;
+import com.jogamp.common.os.DynamicLibraryBundleInfo;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.RunnableExecutor;
+import com.jogamp.common.util.cache.TempJarCache;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.*;
+
+/* pp */ final class OVRDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
+ private static final List<String> glueLibNames;
+ static {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Platform.initSingleton();
+
+ if(TempJarCache.isInitialized()) {
+ // only: joal.jar -> joal-natives-<os.and.arch>.jar
+ JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { OVRDynamicLibraryBundleInfo.class }, null, null );
+ }
+ return null;
+ }
+ });
+
+ glueLibNames = new ArrayList<String>();
+ glueLibNames.add("oculusvr");
+ }
+
+ /* pp */ OVRDynamicLibraryBundleInfo() {
+ }
+
+ /**
+ * <p>
+ * Returns <code>true</code>,
+ * since we might load the library and allow symbol access to subsequent libs.
+ * </p>
+ */
+ @Override
+ public final boolean shallLinkGlobal() { return true; }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns <code>false</code>.
+ * </p>
+ */
+ @Override
+ public final boolean shallLookupGlobal() { return true; }
+
+ @Override
+ public final List<String> getGlueLibNames() {
+ return glueLibNames;
+ }
+
+ @Override
+ public final List<List<String>> getToolLibNames() {
+ return new ArrayList<List<String>>(); // None
+ }
+
+ @Override
+ public final List<String> getToolGetProcAddressFuncNameList() {
+ return null;
+ }
+
+ @Override
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
+ return 0;
+ }
+
+ @Override
+ public final boolean useToolGetProcAdressFirst(String funcName) {
+ return false;
+ }
+
+ @Override
+ public final RunnableExecutor getLibLoaderExecutor() {
+ return DynamicLibraryBundle.getDefaultRunnableExecutor();
+ }
+}
+
+
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRException.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRException.java
new file mode 100644
index 000000000..e65338025
--- /dev/null
+++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRException.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2014 JogAmp Community. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.jogamp.oculusvr;
+
+/** A generic exception for OculusVR errors used throughout the binding
+ as a substitute for {@link RuntimeException}. */
+@SuppressWarnings("serial")
+public class OVRException extends RuntimeException {
+ /** Constructs an ALException object. */
+ public OVRException() {
+ super();
+ }
+
+ /** Constructs an ALException object with the specified detail
+ message. */
+ public OVRException(String message) {
+ super(message);
+ }
+
+ /** Constructs an ALException object with the specified detail
+ message and root cause. */
+ public OVRException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /** Constructs an ALException object with the specified root
+ cause. */
+ public OVRException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java
new file mode 100644
index 000000000..a7c64940f
--- /dev/null
+++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.oculusvr;
+
+import com.jogamp.common.GlueGenVersion;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.VersionUtil;
+import com.jogamp.common.util.JogampVersion;
+
+import java.util.jar.Manifest;
+
+public class OVRVersion extends JogampVersion {
+
+ protected static volatile OVRVersion jogampCommonVersionInfo;
+
+ protected OVRVersion(String packageName, Manifest mf) {
+ super(packageName, mf);
+ }
+
+ public static OVRVersion getInstance() {
+ if(null == jogampCommonVersionInfo) { // volatile: ok
+ synchronized(OVRVersion.class) {
+ if( null == jogampCommonVersionInfo ) {
+ final String packageName = "com.jogamp.oculusvr";
+ final Manifest mf = VersionUtil.getManifest(OVRVersion.class.getClassLoader(), packageName);
+ jogampCommonVersionInfo = new OVRVersion(packageName, mf);
+ }
+ }
+ }
+ return jogampCommonVersionInfo;
+ }
+
+ public static StringBuilder getAvailableCapabilitiesInfo(final int ovrHmdIndex, StringBuilder sb) {
+ if(null==sb) {
+ sb = new StringBuilder();
+ }
+ 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);
+ } else {
+ sb.append("\thmd."+ovrHmdIndex+" not available").append(Platform.getNewline());
+ }
+ }
+ // Nope .. ovr.ovr_Shutdown();
+ sb.append(Platform.getNewline());
+ return sb;
+ }
+
+ public static StringBuilder getAllAvailableCapabilitiesInfo(StringBuilder sb) {
+ if(null==sb) {
+ sb = new StringBuilder();
+ }
+ sb.append(Platform.getNewline()).append(Platform.getNewline());
+ sb.append("HMD.0 Capabilities: ").append(Platform.getNewline());
+ getAvailableCapabilitiesInfo(0, sb);
+ return sb;
+ }
+
+ public static void main(String args[]) {
+ System.err.println(VersionUtil.getPlatformInfo());
+ System.err.println(GlueGenVersion.getInstance());
+ // System.err.println(NativeWindowVersion.getInstance());
+ System.err.println(OVRVersion.getInstance());
+ System.err.println(OVRVersion.getAllAvailableCapabilitiesInfo(null).toString());
+ }
+}
+
diff --git a/src/oculusvr/native/OVRImplMisc.cpp b/src/oculusvr/native/OVRImplMisc.cpp
new file mode 100644
index 000000000..08ebddf62
--- /dev/null
+++ b/src/oculusvr/native/OVRImplMisc.cpp
@@ -0,0 +1,30 @@
+#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); }
+