Skip to main content
Up and Coming
April 5, 2013

Java Wrapper. First Version!

Hi There,
As a first note: I don't have my rift yet, so I have been writing this Java wrapper for the OR blindly. I would be cool if someone with a Rift and interest in Java could test it out:
https://dl.dropbox.com/u/8241387/OVR/JRift_alpha.zip

It is compiled for a 32-bit Java Runtime. And you can just call the contained JRift.bat to make it start a loop to read from the Rift sensors:

OculusRift or = new OculusRift();
or.init();

HMDInfo hmdInfo = or.getHMDInfo();
System.out.println(hmdInfo);

while (or.isInitialized()) {
or.poll();

System.out.println("Yaw: " + or.getYaw() + " Pitch: " + or.getPitch() + " Roll: " + or.getRoll());

try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

or.destroy();


Any comment is welcome.

Cheers,
Daniel

    43 replies

    April 14, 2014
    "JoffreyVR" wrote:
    Hi everyone,
    I'm 19, 2y-IT student and i'm currently in a working experience at the Spatial Database Center (CDS) of Strasbourg. I have to make a software prototype with the Oculus with Java.
    I've decided to use jMonkeyEngine just to try to modelize planets, and being able just to watch them.
    I'll be very glad if somebody would be able to explain me how can I generate the screen which is necessary to the Oculus if you want to get VR, i'm talking about this screen with the double view with the shift between these two images: http://img0.gm.gtsstatic.com/wallpapers/c2a626926b723c816ebcafafc3d05c2c_large.jpeg
    I've never done 3D until this experience and I'm not really good at, but I managed to modelize a planet, and know, before implements motion functions, i'd like to visualize it in VR with the Oculus.
    Of anybody could help, it will be very pleasant :)
    Thank you all, and sorry for my bad english x)
    - Joffrey (no jokes about GoT pls :cry: !)


    *Rant about why not to use Java for anything*
    Right, we got that out of the way (I'm not a huge Java fan). I still want to help people out though, hence why I'm making this reply.
    I want to start off by saying that if you've never worked with 3D before at all, I wouldn't recommend using Java, C++, C#, or any other raw language. What I WOULD recommend is using Unity3D, Unreal, or any other prebuilt engine that supports OR.
    That being said, if you're still sure you want to use Java, I strongly suggest learning the basics of 3D before you begin going into using the Oculus Rift. Otherwise you'll have no idea what's actually going on, and that isn't really coding, as much as it is mere copy-pastaing.
    I'm not saying you need to read a bunch of books on 3D, I'm just saying. learn how a Vector 3, Matrix and Quaternion works, and what it is, in your desired language (Java in this case). Not necessarily how they work in-depth, just how to use a matrix for Rotation, or Positioning, etc.
    Once you got that settled, continue onto learning how the camera works, if you haven't already.

    After this, I suppose you should be good to go with actually using some/all of the code you find on here.


    This is at least how I've got my experience with 3D in C# (XNA), and I'm doing pretty well if I might say so myself.

    Thanks
    Keta
    Up and Coming
    April 14, 2014
    I solved this in a simpler way:

    viewtopic.php?f=20&t=88&start=20#p84536
    "It's like Homeworld in first person." Disable Aero and vSync for a completely simulator sickness free experience with 2xHz FPS. Keep the config utility open for tracking to work.
    Up and Coming
    April 15, 2014
    Thanks for your answer Keta. I know that I have to learn the basics (i'm doing it for 15 days now) so I begin to understand how the 3D works. I've already display what I want and I just want to display it at the Oculus dual screen format, that's why I've posted.

    Thank you rupy, i'll take a look at this topic.
    ~ Don't forget: What you want, will be.