From 99b3b0e0282acbd5fff649eb86e4bfb980c94ec4 Mon Sep 17 00:00:00 2001 From: Jason Walters Date: Thu, 17 Oct 2013 15:35:17 -0400 Subject: [PATCH 1/4] Update ofxOculusRift.h adding way to lock your view. helpful if you're viewing video footage. think of this as a constant lookAt. --- src/ofxOculusRift.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ofxOculusRift.h b/src/ofxOculusRift.h index 28ac4aa..a6acc36 100755 --- a/src/ofxOculusRift.h +++ b/src/ofxOculusRift.h @@ -35,6 +35,7 @@ class ofxOculusRift bool setup(); bool isSetup(); + bool lockView; void beginLeftEye(); void endLeftEye(); From db6c7c39f23387d6e6f034e74574b24f97784c63 Mon Sep 17 00:00:00 2001 From: Jason Walters Date: Thu, 17 Oct 2013 15:38:12 -0400 Subject: [PATCH 2/4] Update ofxOculusRift.cpp camera lock + disabled system destroy as it causes a crash. --- src/ofxOculusRift.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ofxOculusRift.cpp b/src/ofxOculusRift.cpp index e4c8db1..39e7250 100755 --- a/src/ofxOculusRift.cpp +++ b/src/ofxOculusRift.cpp @@ -80,7 +80,7 @@ ofxOculusRift::~ofxOculusRift(){ if(bSetup){ pSensor.Clear(); pManager.Clear(); - System::Destroy(); + //System::Destroy(); // causes the system to crash. bSetup = false; } } @@ -200,7 +200,11 @@ void ofxOculusRift::setupEyeParams(OVR::Util::Render::StereoEye eye){ if(baseCamera != NULL){ headRotation = headRotation * baseCamera->getGlobalTransformMatrix(); } - ofLoadMatrix( ofMatrix4x4::getInverseOf( headRotation )); + + // lock the camera when enabled... + if (!lockView) { + ofLoadMatrix( ofMatrix4x4::getInverseOf( headRotation )); + } ofViewport(toOf(VP)); ofMatrix4x4 viewAdjust = toOf(eyeRenderParams.ViewAdjust); From f45001c8d23e6f2e2300a2f7b87b6bfde0d4bd59 Mon Sep 17 00:00:00 2001 From: Jason Walters Date: Thu, 17 Oct 2013 15:39:16 -0400 Subject: [PATCH 3/4] Update testApp.cpp added key command to perform view lock in the demo. --- example-OculusRiftRendering/src/testApp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/example-OculusRiftRendering/src/testApp.cpp b/example-OculusRiftRendering/src/testApp.cpp index 34e6507..113b613 100755 --- a/example-OculusRiftRendering/src/testApp.cpp +++ b/example-OculusRiftRendering/src/testApp.cpp @@ -108,6 +108,10 @@ void testApp::keyPressed(int key) if(key == 's'){ oculusRift.reloadShader(); } + + if(key == 'l'){ + oculusRift.lockView = !oculusRift.lockView; + } } //-------------------------------------------------------------- @@ -156,4 +160,4 @@ void testApp::gotMessage(ofMessage msg) void testApp::dragEvent(ofDragInfo dragInfo) { -} \ No newline at end of file +} From ff2b52f1a516879308b9eff8563942e5a1f4dca2 Mon Sep 17 00:00:00 2001 From: Jason Walters Date: Thu, 17 Oct 2013 17:22:21 -0400 Subject: [PATCH 4/4] Update ofxOculusRift.cpp --- src/ofxOculusRift.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ofxOculusRift.cpp b/src/ofxOculusRift.cpp index 39e7250..45f248b 100755 --- a/src/ofxOculusRift.cpp +++ b/src/ofxOculusRift.cpp @@ -73,6 +73,7 @@ ofRectangle toOf(const OVR::Util::Render::Viewport vp){ ofxOculusRift::ofxOculusRift(){ baseCamera = NULL; bSetup = false; + viewLock = false; bUsePredictedOrientation = true; }