20 : _usingDebugHmd(false),
21 _positionTrackingEnabled(false),
22 _lowPersistanceEnabled(false),
23 _timeWarpEnabled(false),
26 _isCameraConnected(false),
27 _isPositionTracked(false),
28 _shaderFileDir(shaderDir)
62 for (
SLint i = 0; i < 2; ++i)
87 glViewport(0, 0, width, height);
88 glBindFramebuffer(GL_FRAMEBUFFER, 0);
89 glClearColor(0, 0, 0, 1);
90 glClear(GL_COLOR_BUFFER_BIT);
91 glDisable(GL_DEPTH_TEST);
92 glDisable(GL_CULL_FACE);
93 glActiveTexture(GL_TEXTURE0);
94 glBindTexture(GL_TEXTURE_2D, tex);
96 sp->
beginUse(
nullptr,
nullptr,
nullptr);
101 sp->
uniform2f(
"u_eyeToSourceUVScale", 0.232f, -0.376f);
102 sp->
uniform2f(
"u_eyeToSourceUVOffset", 0.246f, 0.5f);
112 glEnable(GL_DEPTH_TEST);
113 glEnable(GL_CULL_FACE);
153 for (
SLint i = 0; i < 2; ++i)
172 SLMat4f flipY(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
SLEyeType
Enumeration for stereo eye type used for camera projection.
Wrapper around Oculus Rift.
void createSLDistortionMesh(DistortionMeshVertexData **ppVertices, uint16_t **ppTriangleListIndices, SLuint *pNumVertices, SLuint *pNumTriangles, bool rightEye, const HmdRenderInfo &hmdRenderInfo, const DistortionRenderDesc &distortion, const ScaleAndOffset2D &eyeToSourceNDC)
SLMat4f ovrMatrix4f_OrthoSubProjection(SLMat4f projection, SLVec2f orthoScale, float orthoDistance, float eyeViewAdjustX)
SLMat4f CreateProjection(bool rightHanded, ovrFovPort tanHalfFov, float zNear, float zFar)
Singleton class for global render state.
SLVec2< SLfloat > SLVec2f
void positionTracking(SLbool val)
const SLVec3f & viewAdjust(SLEyeType eye)
const SLQuat4f & orientation(SLEyeType eye)
void lowPersistance(SLbool val)
SLbool _hmdSettingsChanged
settings need to be updated flag
const SLVec3f & position(SLEyeType eye)
SLVec2i _resolution
Resolution of the HMD.
SLVec3f _viewAdjust[2]
view adjust vector
SLGLVertexArray _distortionMeshVAO[2]
distortion meshes for left and right eye
const SLMat4f & orthoProjection(SLEyeType eye)
const SLMat4f & projection(SLEyeType eye)
void renderDistortion(SLint width, SLint height, SLuint tex, const SLCol4f &background)
SLVec2i _outputRes
output resolution used for ortho projection
SLVec3f _position[2]
eye position
SLMat4f _projection[2]
projection matrices for left and right eye
void calculateHmdValues()
recalculate HMD settings changed
SLbool _displaySleep
is the display of the rift currently off
SLbool _timeWarpEnabled
time warp correction enabled
SLbool _lowPersistanceEnabled
low persistence rendering enabled
SLQuat4f _orientation[2]
eye orientation
SLGLOculus(SLstring shaderDir)
SLfloat _resolutionScale
required resolution scale for a 1.0 min pixel density
void timeWarp(SLbool val)
SLGLProgram * _stereoOculusDistProgram
void renderResolution(SLint width, SLint height)
void displaySleep(SLbool val)
SLMat4f _orthoProjection[2]
projection for 2d elements
SLbool _positionTrackingEnabled
is position tracking enabled
Generic Shader Program class inherited from SLGLProgram.
Encapsulation of an OpenGL shader program object.
SLint uniformMatrix4fv(const SLchar *name, SLsizei count, const SLfloat *value, GLboolean transpose=false) const
Passes a 4x4 float matrix values py pointer to the uniform variable "name".
void beginUse(SLCamera *cam, SLMaterial *mat, SLVLight *lights)
SLint uniform2f(const SLchar *name, SLfloat v0, SLfloat v1) const
Passes the float values v0 & v1 to the uniform variable "name".
SLint uniform1i(const SLchar *name, SLint v0) const
Passes the int values v0 to the uniform variable "name".
void endUse()
SLGLProgram::endUse stops the shader program.
void perspective(T fov, T aspect, T n, T f)
Defines a perspective projection matrix with a field of view angle.
void translate(T tx, T ty, T tz=0)
void set(T x, T y, T z, T w)
void set(const T X, const T Y)
void set(const T X, const T Y, const T Z)
float DownTan
The tangent of the angle between the viewing vector and the bottom edge of the field of view.
float UpTan
The tangent of the angle between the viewing vector and the top edge of the field of view.
float RightTan
The tangent of the angle between the viewing vector and the right edge of the field of view.
float LeftTan
The tangent of the angle between the viewing vector and the left edge of the field of view.