Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/cinder/vr/oculus/Hmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class Hmd : public vr::Hmd {

glm::ivec2 getNativeResolution() const { return fromOvr( mHmdDesc.Resolution ); }
glm::ivec2 getRenderTargetSize() const { return mRenderTargetSize; }

protected:
// ---------------------------------------------------------------------------------------------
// Protected methods inherited from ci::vr::Hmd
Expand All @@ -127,7 +126,6 @@ class Hmd : public vr::Hmd {
bool mIsVisible = true;

// Oculus SDK
long long mFrameIndex = 0;
::ovrSession mSession = nullptr;
::ovrHmdDesc mHmdDesc;

Expand Down
15 changes: 10 additions & 5 deletions src/cinder/vr/oculus/Hmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ Hmd::Hmd( ci::vr::oculus::Context *context )
initializeRenderTarget();
onMonoscopicChange();
app::getWindow()->getSignalResize().connect( [this](){
initializeMirrorTexture( app::getWindowSize() );
try {
initializeMirrorTexture( app::getWindowSize() );
}
catch( ci::vr::oculus::Exception& exc ) {
CI_LOG_EXCEPTION( exc.what(), exc );
}
} );

//ovr_SetTrackingOriginType( mSession, ovrTrackingOrigin_EyeLevel );
Expand Down Expand Up @@ -275,7 +280,7 @@ void Hmd::bind()
// Calculate input ray
calculateInputRay();

::ovr_GetEyePoses( mSession, mFrameIndex, ovrTrue, mEyeViewOffset, mEyeRenderPose, &mSensorSampleTime );
::ovr_GetEyePoses( mSession, 0, ovrTrue, mEyeViewOffset, mEyeRenderPose, &mSensorSampleTime );
const ::ovrEyeType kEyes[2] = { ::ovrEye_Left, ::ovrEye_Right };
for( auto eye : kEyes ) {
// View matrix
Expand Down Expand Up @@ -342,11 +347,9 @@ void Hmd::submitFrame()
mBaseLayer.ColorTexture[1] = NULL;

ovrLayerHeader* layers = &mBaseLayer.Header;
auto result = ::ovr_SubmitFrame( mSession, mFrameIndex, &viewScaleDesc, &layers, 1 );
auto result = ::ovr_SubmitFrame( mSession, 0, &viewScaleDesc, &layers, 1 );
mIsVisible = ( result == ovrSuccess );

++mFrameIndex;

// Update frame index
if( mIsVisible ) {
updateElapsedFrames();
Expand Down Expand Up @@ -459,6 +462,7 @@ void Hmd::calculateInputRay()
void Hmd::drawMirroredImpl( const ci::Rectf& r )
{
if( isMirrored() && mMirrorTexture ) {
gl::enable( GL_FRAMEBUFFER_SRGB );
ci::gl::ScopedDepth scopedDepth( false );
ci::gl::ScopedColor scopedColor( 1, 1, 1 );
ci::gl::ScopedModelMatrix scopedModelMatrix;
Expand Down Expand Up @@ -500,6 +504,7 @@ void Hmd::drawMirroredImpl( const ci::Rectf& r )
}
break;
}
gl::disable( GL_FRAMEBUFFER_SRGB );
}
}

Expand Down