8 #ifndef _OSG_OCULUSDEVICE_H_
9 #define _OSG_OCULUSDEVICE_H_
14 #include <OVR_CAPI_GL.h>
17 #include <osg/Texture2D>
18 #include <osg/Version>
19 #include <osg/FrameBufferObject>
42 void blitTexture(osg::State* state,
int width,
int height);
50 void setup(osg::State& state);
74 void blitTexture(osg::GraphicsContext* gc,
int width,
int height);
95 virtual void operator()(osg::RenderInfo& renderInfo)
const;
111 virtual void operator()(osg::RenderInfo& renderInfo)
const;
129 OculusDevice(
float nearClip,
float farClip,
const float pixelsPerDisplayPixel = 1.0f,
const float worldUnitsPerMetre = 1.0f,
const int samples = 0,
unsigned int mirrorTextureWidth = 960);
157 osg::Camera*
createRTTCamera(
OculusDevice::Eye eye, osg::Transform::ReferenceFrame referenceFrame,
const osg::Vec4& clearColor, osg::GraphicsContext* gc = 0)
const;
216 virtual void operator()(osg::RenderInfo& renderInfo)
const;
osg::Matrixf m_rightEyeProjectionMatrix
Definition: oculusdevice.h:197
enum OculusDevice::Eye_ Eye
OculusDevice(float nearClip, float farClip, const float pixelsPerDisplayPixel=1.0f, const float worldUnitsPerMetre=1.0f, const int samples=0, unsigned int mirrorTextureWidth=960)
void calculateProjectionMatrices()
void setPerfHudMode(int mode)
osg::ref_ptr< osg::Texture2D > depthBuffer() const
Definition: oculusdevice.h:32
GLint m_width
Definition: oculusdevice.h:80
virtual ~OculusMirrorTexture()
Definition: oculusdevice.h:76
Definition: oculusdevice.h:119
GLuint createProgram(const std::string &name)
int myBlitHeight
Definition: oculusdevice.h:63
OculusTextureBuffer(const ovrSession &session, osg::ref_ptr< osg::State > state, const ovrSizei &size, int msaaSamples)
void createRenderBuffers(osg::ref_ptr< osg::State > state)
void resetSensorOrientation() const
bool submitFrame(unsigned int frameIndex=0)
const ovrSession m_session
Definition: oculusdevice.h:44
int myBlitWidth
Definition: oculusdevice.h:62
Definition: oculusdevice.h:22
GLuint m_MSAA_ColorTex
Definition: oculusdevice.h:55
osg::Matrix projectionMatrixLeft() const
void trySetProcessAsHighPriority() const
void onPreRender(osg::RenderInfo &renderInfo)
voidpf void uLong size
Definition: ioapi.h:39
OculusPreDrawCallback(osg::Camera *camera, OculusTextureBuffer *textureBuffer)
Definition: oculusdevice.h:89
ovrPosef m_headPose[2]
Definition: oculusdevice.h:192
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
float nearClip() const
Definition: oculusdevice.h:148
osg::observer_ptr< OculusTextureBuffer > m_textureBuffer
Definition: oculusdevice.h:98
void setEnableTextureBlit(bool set, int x, int y)
GLint height() const
Definition: oculusdevice.h:73
GLuint m_MSAA_DepthTex
Definition: oculusdevice.h:56
osg::GraphicsContext::Traits * graphicsContextTraits() const
virtual void operator()(osg::RenderInfo &renderInfo) const
int textureWidth() const
Definition: oculusdevice.h:27
osg::Quat orientation() const
Definition: oculusdevice.h:155
double m_frameTiming
Definition: oculusdevice.h:191
unsigned int screenResolutionHeight() const
ovrEyeRenderDesc m_eyeRenderDesc[2]
Definition: oculusdevice.h:190
osg::Matrix projectionOffsetMatrixLeft() const
osg::observer_ptr< osg::Camera > m_camera
Definition: oculusdevice.h:97
OculusDevice & operator=(const OculusDevice &)
OculusPostDrawCallback(osg::Camera *camera, OculusTextureBuffer *textureBuffer)
Definition: oculusdevice.h:105
int samples() const
Definition: oculusdevice.h:29
osg::Vec3f m_rightEyeAdjust
Definition: oculusdevice.h:199
GLuint myCurrentTextureId
Definition: oculusdevice.h:59
osg::ref_ptr< OculusMirrorTexture > m_mirrorTexture
Definition: oculusdevice.h:186
osg::Matrixf m_leftEyeProjectionMatrix
Definition: oculusdevice.h:196
osg::Matrix projectionOffsetMatrixRight() const
osg::Vec2i m_textureSize
Definition: oculusdevice.h:48
const float m_worldUnitsPerMetre
Definition: oculusdevice.h:183
ovrHmdDesc m_hmdDesc
Definition: oculusdevice.h:180
GLuint m_mirrorFBO
Definition: oculusdevice.h:82
osg::observer_ptr< OculusTextureBuffer > m_textureBuffer
Definition: oculusdevice.h:114
osg::ref_ptr< osg::Texture2D > m_depthBuffer
Definition: oculusdevice.h:47
osg::Matrix projectionMatrixCenter() const
unsigned int screenResolutionWidth() const
virtual ~OculusTextureBuffer()
Definition: oculusdevice.h:39
GLint width() const
Definition: oculusdevice.h:72
GLuint myDownsampleShader
Definition: oculusdevice.h:61
int textureHeight() const
Definition: oculusdevice.h:28
float m_nearClip
Definition: oculusdevice.h:204
Definition: oculusdevice.h:102
osg::Camera * createRTTCamera(OculusDevice::Eye eye, osg::Transform::ReferenceFrame referenceFrame, const osg::Vec4 &clearColor, osg::GraphicsContext *gc=0) const
osg::Vec3f m_leftEyeAdjust
Definition: oculusdevice.h:198
osg::observer_ptr< osg::Camera > m_camera
Definition: oculusdevice.h:113
Definition: oculusdevice.h:127
void blitTexture(osg::State *state, int width, int height)
Definition: oculusdevice.h:86
ovrTextureSwapChain m_textureSwapChain
Definition: oculusdevice.h:45
ovrMirrorTexture m_texture
Definition: oculusdevice.h:79
void calculateEyeAdjustment()
osg::Matrix projectionMatrixRight() const
void onPostRender(osg::RenderInfo &renderInfo)
osg::Quat m_orientation
Definition: oculusdevice.h:202
osg::Matrix viewMatrixRight() const
Definition: oculusdevice.h:125
unsigned int m_mirrorTextureWidth
Definition: oculusdevice.h:188
osg::Matrix viewMatrixLeft() const
GLuint m_MSAA_FBO
Definition: oculusdevice.h:54
ovrTextureSwapChain textureSwapChain() const
Definition: oculusdevice.h:30
const char int mode
Definition: ioapi.h:38
float m_farClip
Definition: oculusdevice.h:205
int m_samples
Definition: oculusdevice.h:206
osg::Vec3 position() const
Definition: oculusdevice.h:154
osg::ref_ptr< osg::Texture2D > colorBuffer() const
Definition: oculusdevice.h:31
ovrVector3f m_viewOffset[2]
Definition: oculusdevice.h:195
virtual void operator()(osg::RenderInfo &renderInfo) const
ovrSession m_session
Definition: oculusdevice.h:179
osg::ref_ptr< osg::Texture2D > m_colorBuffer
Definition: oculusdevice.h:46
Definition: oculusdevice.h:213
ovrPosef m_eyeRenderPose[2]
Definition: oculusdevice.h:193
GLuint m_Oculus_FBO
Definition: oculusdevice.h:53
const float m_pixelsPerDisplayPixel
Definition: oculusdevice.h:182
OculusMirrorTexture(ovrSession &session, osg::ref_ptr< osg::State > state, int width, int height)
float farClip() const
Definition: oculusdevice.h:149
void blitTexture(osg::GraphicsContext *gc, int width, int height)
osg::ref_ptr< OculusTextureBuffer > m_textureBuffer[2]
Definition: oculusdevice.h:185
void setup(osg::State &state)
osg::Vec3 m_position
Definition: oculusdevice.h:201
ovrLayerEyeFov m_layerEyeFov
Definition: oculusdevice.h:194
void setupMSAA(osg::State &state)
int m_samples
Definition: oculusdevice.h:57
void updatePose(unsigned int frameIndex=0)
Definition: oculusdevice.h:126
bool myShouldBlitTexture
Definition: oculusdevice.h:60
const ovrSession m_session
Definition: oculusdevice.h:78
virtual void operator()(osg::RenderInfo &renderInfo) const
Eye_
Definition: oculusdevice.h:123
GLint m_height
Definition: oculusdevice.h:81
Definition: oculusdevice.h:66
void initializeEyeRenderDesc()