OculusRiftP5
Oculus Rift Library for Processing
The library is currently distributed by PDE format (OculusRift.pde). First, see and run OculusRift_BasicExample.
Examples
OculusRift_BasicExample
This example shows simple scene that contains a wall, a floorboard, a cube, and stereo picture.
OculusRift_PanoramaView
It shows a spherical panorama view. The included picture was taken by RICOH THETA.
OculusRift_RadarExample
It shows a radar denoting user's head direction.
OculusRift_VideoSeeThrough
This is an example for making augmented reality. You need web camera for running it. This code uses sarxos's webcam-capture library instead of Processing's Capture class, because jna.jar used by Processing's Capture class conflicts with jna-4.1.0.jar used in OculusRift.pde.
Environment
It was checked that it worked in the following environment.
- Oculus Rift DK2 (currently only for DK2)
- Oculus Runtime V0.5.0.1-beta
- Processing 2.2.1
- Windows 8.1 and OS X Yosemite (v10.10.2)
How to use
Skeleton
OculusRift oculus;
void setup() {
size( 1920, 1080, P3D );
oculus = new OculusRift(this);
oculus.enableHeadTracking();
}
void draw() {
oculus.draw();
}
// Scene for OculusRift
void onDrawScene(int eye) {
}
Please make the function named "onDrawScene(int eye)" and write a code about 3D scene in it. In the function, the scale is approximately real scale and the unit is a millimeter. The default eye position is on the origin (0, 0, 0) in the scene. The parameter "eye" gives LEFT or RIGHT.
API
Method | Description |
---|---|
boolean enableHeadTracking(); | Enables head tracking. |
void draw(); | Draws a stereo image for Oculus Rift display. |
void resetHeadState(); | Resets the head state matrix by current state. |
PMatrix3D getMatrix(); | Gets the current head state matrix. |
Acknowledgements
Thanks a lot for the following codes.