Setup Oculus Rift support in JME

Hello everyone,

I’ve been trying to get the oculus rift library to work inside the JME IDE. I tried to follow the instructions and get help from the irc channel. Without much success. Here are all the things that I tried.

  1. Checkout the jmonkeyengine-oculus-rift code from here.
  2. Get the stable 3.0 Phr00t version of JME here. (I tried this later with 3.1)
  3. ant build in the Phr00t JME.
  4. ant build-zip-for-installer inside the sdk folder.
  5. Unzip the newly created jmeplatform inside /sdk/dist
  6. Open the jmonkeyengine-oculus-rift project in this new jmeplatform
  7. Added the following jar files:
    jna-4.1.0.jar
    guava-17.0.jar
    jovr-0.4.4.0.jar
    JMonkeyOculusRift.jar
  8. Run the project

I need to add a line of text here to get the numbering right.

  1. Open my own install of JME.
  2. Install the Oculus Rift Support plugin from Tools-Plugins-Available Plugins.
  3. Open the jmonkeyengine-oculus-rift project.
  4. Add the Oculus Rift Support library to this project plus these from the project folder:
    jna-4.1.0.jar
    guava-17.0.jar
    jovr-0.4.4.0.jar
  5. Run the project

I would like to first know what the correct way is to install and use this library before I start to post the error messages. As you can see I didn’t just give up after 10 minutes. I just don’t know how this works.

Thanks!

What problem are you facing?

Well alright. What is the correct way of installing these libraries and testing them without a physical DK2?

It looks like a library issue, even though you seem to have the correct ones.
If you are running the jMonkeyOculusRift project directly, you don’t need the OculusRift - OVR - Support lib added. That might actually be the issue here.

Also, you actually don’t need to compile the SDK. It’s enough if you build the engine and add the jar files from it.

(Btw, method 2 has not been confirmed as working)

Alright. So I removed the Oculus Rift - OVR - Support library. Is this a successfull run? This is the only one that doesn’t crash when I run it.

Yes, that should be succesful.

I do believe that TestOVRApplication should work as well.

This is what outputs when I run TestOVRApplication.java.

That looks like it can be related to 3.1 changes.
Haven’t had time to look at that, yet.

I did this in the 3.0 stable. This is what happens when I run it in 3.1.

I recently cloned phr00t’s JME build and I’m also trying to setup and I’m stuck with building the project. Did the project change from ant to gradle? Because I don’t see any build.xml. Also, the build fails when I try to ‘gradle’ in the command prompt, giving this error:

============================

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\AnthonyAllan\Desktop\jmonkeyengine\jme3-bullet-native\build
    .gradle’ line: 14

  • What went wrong:
    A problem occurred evaluating project ‘:jme3-bullet-native’.

Could not find method libraries() for arguments [build_2r1btfaa9hws7od55qi7eqi
xs$_run_closure2@3214bad] on project ‘:jme3-bullet-native’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug
    option to get more log output.

BUILD FAILED

Total time: 3.968 secs

============================

what am I doing wrong?

There should be no need to build the project yourself. I maintain built libraries here:

Same goes for the Rift libraries:

I think I skip building the native bullet libraries when I build it. I supply the last working collection of them here:

In general, if you build a gradle-based project that has gradlew setup and a regular gradle build fails… then try the gradlew wrapper… because it could be a gradle version issue.

Edit: nvm the launcher problem, it gets fixed when I set to duplicate mode instead of Direct mode

Edit2: nvm everything below this edit. Turns out I’m just an idiot for reusing the 3-month old example and trying to make it work. It seems fine now, though I wonder how can I show the game screen on DK1 with extended display, because right now I just duplicate my display to show on my DK1, but it’s difficult to program on my main display with low resolution.

nvm that. I added the 4 jars from the jmonkeyengine-virtual-reality, the Oculus VR Support plugin library, and the jars at jmonkeyengine/dist/lib/ and it seems to run without errors.

The problem now is the launcher gets fed up when I changed SimpleApplication into VRApplication, though it apparently gets fixed when I clicked on the dropdown buttons. Another problem is when I launch the game it’s also fed up, the vignette shows and the screen is flickering crazily, I can’t get a screenshot of it because it’s like turning on and off very fast.

This is my code, which is based from the example in jmonkeyengine-virtual-reality, which is already outdated.

Edit: removed code

I have no idea what the problem is, especially because I’m also new to JMonkeyEngine.

Mrz 20, 2015 12:06:46 PM com.jme3.system.JmeDesktopSystem initialize

INFO: Running on jMonkeyEngine 3.0.10
Mrz 20, 2015 12:06:46 PM com.jme3.system.Natives extractNativeLibs
INFO: Extraction Directory: D:\projects\Java4Kinect
Exception in thread “main” java.lang.NoSuchMethodError: com.jme3.system.AppSettings.setSwapBuffers(Z)V
at jmevr.app.VRApplication.start(VRApplication.java:146)
at mygame.Main.main(Main.java:66)
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Lwjgl 2.9.0 context running on thread LWJGL Renderer Thread
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Adapter: nvd3dumx,nvwgf2umx,nvwgf2umx
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Driver Version: 9.18.13.4448
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Vendor: NVIDIA Corporation
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: OpenGL Version: 4.4.0 NVIDIA 344.48
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: Renderer: GeForce GTX 780/PCIe/SSE2
Mrz 20, 2015 12:06:55 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: GLSL Ver: 4.40 NVIDIA via Cg compiler
Mrz 20, 2015 12:06:55 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Device: OpenAL Soft
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Vendor: OpenAL Community
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Renderer: OpenAL Soft
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio Version: 1.1 ALSOFT 1.15.1
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: AudioRenderer supports 64 channels
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio effect extension version: 1.0
Mrz 20, 2015 12:06:55 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
Mrz 20, 2015 12:06:55 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NoClassDefFoundError: com/jme3/app/LostFocusBehavior
at jmevr.app.VRApplication.simpleInitApp(VRApplication.java:138)
at mygame.Main.simpleInitApp(Main.java:71)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: com.jme3.app.LostFocusBehavior
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
… 6 more

Java Result: 1

where sould i copy the jars? i copied and replaced them fromj monkeyengine-master\dist\lib to jmonkeyengine/libs and jmonkeyengine-master\lib to jmonkeyengine/libs, is this done right?

EDIT:
nevermind, got it running.
all jars nee to be added as libraries. the orginal ones have to be removed.