H3D API
2.4.1
|
The OculusRiftHandler class provides support for the Oculus Rift VR device. More...
#include <H3D/OculusRiftHandler.h>
Public Member Functions | |
OculusRiftHandler () | |
Constructor. | |
~OculusRiftHandler () | |
Destructor. | |
bool | isInitialized () |
bool | initVR () |
Initializes the connection to the Oculus Rift. More... | |
bool | initVRBuffers (int window_width, int window_height) |
Initializes the OpenGL buffers to use for rendering. More... | |
void | onRenderStart () |
Should be called in the beginning of each frame. More... | |
void | onEyeRender (int eye_index, H3D::Matrix4f &view_matrix, H3D::Matrix4f &projection_matrix) |
Should be called just before rendering the specified eye. More... | |
void | onEyeRenderFinish (int eye_index) |
Should be called when rendering for the specified eye is done. More... | |
void | submitFrame () |
Should be called when all rendering is done to submit the current frame to the HMD display. | |
void | blitMirror (ovrEyeType num_eyes=ovrEye_Count, int offset=0) |
Should be called after submitFrame to transfer the data to the back buffer (this is to update the view in the normal render window) | |
void | destroyVR () |
Cleanup everything. | |
void | recenterTracking () |
Recenter the HMD tracking so that the current view direction is center,. | |
const ovrSizei | getResolution () const |
Gets the resolution of the HMD display. | |
H3D::Matrix4f | getEyeMVPMatrix (int eye_index) const |
Gets the view-projection matrix for an eye. | |
void | setMSAA (bool val) |
Toggle multi-sample anti-aliasing. | |
bool | MSAAEnabled () const |
Get current status of multi-sample anti-aliasing. More... | |
The OculusRiftHandler class provides support for the Oculus Rift VR device.
It provides convenience functions to initialize and render OpenGL content to the OculusRift display. It is based on the MinimumOpenGL code by Krzysztof Kondrak that can be found at https://github.com/kondrak/oculusvr_samples.
Current SDK version supported is 1.3.
To integrate with your solution
bool OculusRiftHandler::initVR | ( | ) |
Initializes the connection to the Oculus Rift.
Referenced by H3D::H3DWindowNode::render().
bool OculusRiftHandler::initVRBuffers | ( | int | window_width, |
int | window_height | ||
) |
Initializes the OpenGL buffers to use for rendering.
window_width | The width of the buffer to use (in pixels). |
window_height | The height of the buffer to use (in pixels). |
Referenced by H3D::H3DWindowNode::render().
|
inline |
Referenced by H3D::H3DWindowNode::render().
|
inline |
Get current status of multi-sample anti-aliasing.
void OculusRiftHandler::onEyeRender | ( | int | eye_index, |
H3D::Matrix4f & | view_matrix, | ||
H3D::Matrix4f & | projection_matrix | ||
) |
Should be called just before rendering the specified eye.
Matrices set in the ooutput parameters should be used in the modelview and projection matrix for the render.
eye_index | The index of the eye (normally 0 for left and 1 for right) |
view_matrix | Output for the view matrix to use for the eye. |
projection_matrix | Output for the projection matrix to use for the eye. |
Referenced by H3D::H3DWindowNode::render().
void OculusRiftHandler::onEyeRenderFinish | ( | int | eye_index | ) |
Should be called when rendering for the specified eye is done.
eye_index | The index of the eye (normally 0 for left and 1 for right) |
Referenced by H3D::H3DWindowNode::render().
void OculusRiftHandler::onRenderStart | ( | ) |
Should be called in the beginning of each frame.
Saves the tracker data from the HMD to be used in the current frame.
Referenced by H3D::H3DWindowNode::render().