Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
swsmith's avatar
swsmith
Honored Guest
12 years ago

Best way to get up and running with lwjgl?

I've just ordered my SDK2 and wan't to get something working prior to it's arrival.
I like to develop in Java and have a strong preference for a minimum of wrapper libraries/frameworks, and was wondering what is best way to go about getting a 3D-cube type demo working in Java (using lwjgl)?

Ideally I would just like 1 extra jni-wrapper library for the Oculus lib (I can't stand libraries that want to pull in 50 different dependent libraries) and as far as I can tell so far there is:

jrift,
jocular

Is either of these preferable and are there any other suggestions for getting started?

7 Replies

  • rupy's avatar
    rupy
    Honored Guest
    I have been using the JMonkey JNI API so far with the DK1 because it's the only driver that has quaternion with compiled Win binary:

    https://code.google.com/p/jmonkeyengine-oculus-rift/

    Seems it's getting some attention lately, so hopefully I will be able to stick with it once DK2 comes out.

    The trick is you need to use quaternion, and landing on your feet with those can be hard since sometimes the coordinate system is not the same, see my post here:

    viewtopic.php?f=39&t=5967

    I use viewports to render the stereoscopic view, has issues on Mac, not tested on Linux:

    viewtopic.php?f=20&t=88&start=20#p84536

    Also there is some resistance in official support towards Java, even after Minecraft:

    viewtopic.php?f=39&t=6022

    Edit: Apparently Stella Artois has been busy building all OS binaries for their JRift implementation one month ago:

    https://github.com/mabrowning/JRift

    I will try it immediately!

    Edit: Ok JRift now has quaternion, builds for all OSes and it works!
  • swsmith's avatar
    swsmith
    Honored Guest
    Thanks for that info, I have no problem working with Quaternion's and have been using them for some time.
  • rupy's avatar
    rupy
    Honored Guest
    Good luck, and please share if you find an easy way to render the distortion with LWJGL!
  • "swsmith" wrote:
    I've just ordered my SDK2 and wan't to get something working prior to it's arrival.
    I like to develop in Java and have a strong preference for a minimum of wrapper libraries/frameworks, and was wondering what is best way to go about getting a 3D-cube type demo working in Java (using lwjgl)?


    This repository contains pretty much what you are asking for. A minimal example for working with the Oculus Rift using the JOVR library (formerly 'Jocular').

    Any wrapper for the Oculus C API probably shouldn't contain it's own math classes, but just provide access to the types that the C API does, and then clients are free to use whatever math library they already have, simply by writing a couple of conversion utilities, as I have done here.

    In fact, last I checked the JMonkeyEngine developers were using JOVR to integrate Rift support directly into the engine. See this thread: http://hub.jmonkeyengine.org/forum/topic/oculus-rift-support/page/17/
  • "rupy" wrote:
    Edit: Ok JRift now has quaternion, builds for all OSes and it works!


    It looks like JRift hasn't been updated for the 0.3.x series of the SDK, and that it's still attempting to design a custom API in Java. JOVR exposes the exact C API that the Oculus SDK does. It doesn't provide built in math types of it's own, but I don't think that's the job of the binding library, since many consumers would already have their own math library and just need to create conversion methods for the 3 or 4 requisite types.

    "rupy" wrote:
    Good luck, and please share if you find an easy way to render the distortion with LWJGL!


    Yeah, I've done exactly that. If you derive from this class: https://github.com/jherico/jocular-examples/blob/master/src/main/java/org/saintandreas/vr/RiftApp.java you can implement renderScene() in your subclass and anything you render will be output with the appropriate Rift distortion.
  • swsmith's avatar
    swsmith
    Honored Guest
    Sounds like JOVR is what I am after, I'll give it a try.

    Thanks!