Module ovr
Oculus Rift support for LÖVE3D.
Currently targets SDK 0.6
Functions
init (quality) | Initialize the Rift. |
shutdown (rift) | Clean up all data used by LibOVR. |
draw_mirror (rift) | Draw a mirror of what is displaying on the Rift. |
projection (rift, eye) | Create a projection matrix appropriate for HMD usage. |
eyes (rift) | Iterator for processing each view. |
submit_frame (rift) | Submit current frame to Rift. |
Functions
- init (quality)
-
Initialize the Rift. Quality defaults to 0.9, set lower or higher depending on GPU performance. In practice 0.9 is usually about ideal, but >1 can be used for super sampling the buffers. Usage:
local rift = ovr.init() -- (later) rift:shutdown()
Parameters:
- quality scaling factor for render buffers.
- shutdown (rift)
-
Clean up all data used by LibOVR.
Call this when shutting down your program.
Parameters:
- rift
- draw_mirror (rift)
-
Draw a mirror of what is displaying on the Rift.
Used to view what is happening on the headset on your monitor.
Note: Blits directly to the window.
Parameters:
- rift
- projection (rift, eye)
-
Create a projection matrix appropriate for HMD usage.
Convenience function.
Shortcut for
cpml.mat4():hmd_perspective(rift.fov[eye], near, far, false, false)
.Parameters:
- rift
- eye eye index
- eyes (rift)
-
Iterator for processing each view.
You should draw the same thing for each eye, just offset with the pose.
Usage:
for eye, pose in rift:eyes() do -- eye is a number, pose is an orientation and a position. -- Usually used like this (ugly! may be cleaned up later). -- cpml.mat4():rotate(pose.orientation:conjugate()):translate(-pose.position) draw(eye, pose) end
This function takes care of frame timings and per-eye render setup for you.
Parameters:
- rift
- submit_frame (rift)
-
Submit current frame to Rift.
Parameters:
- rift