SLProject 4.0.000
SLGLOculus Class Reference

Wrapper around Oculus Rift Devkit 2. More...

#include <SLGLOculus.h>

Public Member Functions

 SLGLOculus (SLstring shaderDir)
 
 ~SLGLOculus ()
 
void init ()
 
const SLQuat4forientation (SLEyeType eye)
 
const SLVec3fposition (SLEyeType eye)
 
const SLVec3fviewAdjust (SLEyeType eye)
 
const SLMat4fprojection (SLEyeType eye)
 
const SLMat4forthoProjection (SLEyeType eye)
 
SLfloat resolutionScale ()
 
void renderResolution (SLint width, SLint height)
 
void beginFrame ()
 
void renderDistortion (SLint width, SLint height, SLuint tex, const SLCol4f &background)
 
void lowPersistance (SLbool val)
 
void timeWarp (SLbool val)
 
void positionTracking (SLbool val)
 
void displaySleep (SLbool val)
 
SLbool isConnected ()
 
SLbool isCameraConnected ()
 
SLbool isPositionTracked ()
 
SLbool isPositionTrackingEnabled ()
 
SLbool isLowPersistanceEnabled ()
 
SLbool isTimeWarpEnabled ()
 

Private Member Functions

void dispose ()
 
void calculateHmdValues ()
 recalculate HMD settings changed More...
 

Private Attributes

SLVec2i _outputRes
 output resolution used for ortho projection More...
 
SLQuat4f _orientation [2]
 eye orientation More...
 
SLVec3f _position [2]
 eye position More...
 
SLMat4f _projection [2]
 projection matrices for left and right eye More...
 
SLMat4f _orthoProjection [2]
 projection for 2d elements More...
 
SLVec3f _viewAdjust [2]
 view adjust vector More...
 
SLGLVertexArray _distortionMeshVAO [2]
 distortion meshes for left and right eye More...
 
SLfloat _resolutionScale
 required resolution scale for a 1.0 min pixel density More...
 
SLbool _usingDebugHmd
 we're using a debug HMD More...
 
SLbool _positionTrackingEnabled
 is position tracking enabled More...
 
SLbool _lowPersistanceEnabled
 low persistence rendering enabled More...
 
SLbool _timeWarpEnabled
 time warp correction enabled More...
 
SLbool _displaySleep
 is the display of the rift currently off More...
 
SLbool _isConnected
 is HMD connected More...
 
SLbool _isCameraConnected
 is position tracker camera connected More...
 
SLbool _isPositionTracked
 is the position tracked (false if out of range) More...
 
SLVec2i _resolution
 Resolution of the HMD. More...
 
SLVec2i _rtSize
 Required resolution for the render target. More...
 
SLbool _hmdSettingsChanged
 settings need to be updated flag More...
 
SLGLProgram_stereoOculusDistProgram = nullptr
 
SLstring _shaderFileDir
 

Detailed Description

Wrapper around Oculus Rift Devkit 2.

This class is depricated since the lib_ovr from Oculus completely changed The lib_ovr that connects the Oculus hardware was removed since it only worked for devkit2 under windows.

Constructor & Destructor Documentation

◆ SLGLOculus()

SLGLOculus::SLGLOculus ( SLstring  shaderDir)

Constructor initializing with default values

◆ ~SLGLOculus()

SLGLOculus::~SLGLOculus ( )

Destructor calling dispose

Member Function Documentation

◆ beginFrame()

void SLGLOculus::beginFrame ( )

Updates rift status and collects data for timewarp

◆ calculateHmdValues()

void SLGLOculus::calculateHmdValues ( )
private

recalculate HMD settings changed

Recalculates values such as projection or render target size This function gets called whenever some settings changed.

◆ displaySleep()

void SLGLOculus::displaySleep ( SLbool  val)

enable or disable position tracking

◆ dispose()

void SLGLOculus::dispose ( )
private

Deletes the buffer object

◆ init()

void SLGLOculus::init ( )

Initialization of the Oculus Rift SDK and the device recognition.

◆ isCameraConnected()

SLbool SLGLOculus::isCameraConnected ( )
inline

◆ isConnected()

SLbool SLGLOculus::isConnected ( )
inline

◆ isLowPersistanceEnabled()

SLbool SLGLOculus::isLowPersistanceEnabled ( )
inline

◆ isPositionTracked()

SLbool SLGLOculus::isPositionTracked ( )
inline

◆ isPositionTrackingEnabled()

SLbool SLGLOculus::isPositionTrackingEnabled ( )
inline

◆ isTimeWarpEnabled()

SLbool SLGLOculus::isTimeWarpEnabled ( )
inline

◆ lowPersistance()

void SLGLOculus::lowPersistance ( SLbool  val)

enable or disable low persistance

◆ orientation()

const SLQuat4f & SLGLOculus::orientation ( SLEyeType  eye)

Returns the Oculus orientation as quaternion. If no Oculus Rift is recognized it returns a unit quaternion.

◆ orthoProjection()

const SLMat4f & SLGLOculus::orthoProjection ( SLEyeType  eye)

Returns an orthogonal projection matrix for the specified eye

◆ position()

const SLVec3f & SLGLOculus::position ( SLEyeType  eye)

Returns the Oculus position.

◆ positionTracking()

void SLGLOculus::positionTracking ( SLbool  val)

enable or disable position tracking

◆ projection()

const SLMat4f & SLGLOculus::projection ( SLEyeType  eye)

Returns an perspective projection matrix for the specified eye

◆ renderDistortion()

void SLGLOculus::renderDistortion ( SLint  width,
SLint  height,
SLuint  tex,
const SLCol4f background 
)

Renders the distortion mesh with time warp and chromatic abberation

◆ renderResolution()

void SLGLOculus::renderResolution ( SLint  width,
SLint  height 
)

Specify the final output resolution for this rift

◆ resolutionScale()

SLfloat SLGLOculus::resolutionScale ( )
inline

◆ timeWarp()

void SLGLOculus::timeWarp ( SLbool  val)

enable or disable timewarp

◆ viewAdjust()

const SLVec3f & SLGLOculus::viewAdjust ( SLEyeType  eye)

Returns the view adjust vector as reported by the HMD for the specified eye

Member Data Documentation

◆ _displaySleep

SLbool SLGLOculus::_displaySleep
private

is the display of the rift currently off

◆ _distortionMeshVAO

SLGLVertexArray SLGLOculus::_distortionMeshVAO[2]
private

distortion meshes for left and right eye

◆ _hmdSettingsChanged

SLbool SLGLOculus::_hmdSettingsChanged
private

settings need to be updated flag

◆ _isCameraConnected

SLbool SLGLOculus::_isCameraConnected
private

is position tracker camera connected

◆ _isConnected

SLbool SLGLOculus::_isConnected
private

is HMD connected

◆ _isPositionTracked

SLbool SLGLOculus::_isPositionTracked
private

is the position tracked (false if out of range)

◆ _lowPersistanceEnabled

SLbool SLGLOculus::_lowPersistanceEnabled
private

low persistence rendering enabled

◆ _orientation

SLQuat4f SLGLOculus::_orientation[2]
private

eye orientation

◆ _orthoProjection

SLMat4f SLGLOculus::_orthoProjection[2]
private

projection for 2d elements

◆ _outputRes

SLVec2i SLGLOculus::_outputRes
private

output resolution used for ortho projection

◆ _position

SLVec3f SLGLOculus::_position[2]
private

eye position

◆ _positionTrackingEnabled

SLbool SLGLOculus::_positionTrackingEnabled
private

is position tracking enabled

◆ _projection

SLMat4f SLGLOculus::_projection[2]
private

projection matrices for left and right eye

◆ _resolution

SLVec2i SLGLOculus::_resolution
private

Resolution of the HMD.

◆ _resolutionScale

SLfloat SLGLOculus::_resolutionScale
private

required resolution scale for a 1.0 min pixel density

◆ _rtSize

SLVec2i SLGLOculus::_rtSize
private

Required resolution for the render target.

◆ _shaderFileDir

SLstring SLGLOculus::_shaderFileDir
private

◆ _stereoOculusDistProgram

SLGLProgram* SLGLOculus::_stereoOculusDistProgram = nullptr
private

◆ _timeWarpEnabled

SLbool SLGLOculus::_timeWarpEnabled
private

time warp correction enabled

◆ _usingDebugHmd

SLbool SLGLOculus::_usingDebugHmd
private

we're using a debug HMD

◆ _viewAdjust

SLVec3f SLGLOculus::_viewAdjust[2]
private

view adjust vector


The documentation for this class was generated from the following files: