diff --git a/applications/gui/src/camera.cpp b/applications/gui/src/camera.cpp index e8a0c80aa8cbe3e90619297a78d2fde7efa7e75b..0a9d04c044e70b615f24733380818ff1a46a1739 100644 --- a/applications/gui/src/camera.cpp +++ b/applications/gui/src/camera.cpp @@ -268,7 +268,6 @@ bool ftl::gui::Camera::setVR(bool on) { src_->set("focal", intrinsic(0, 0)); src_->set("centre_x", intrinsic(0, 2)); src_->set("centre_y", intrinsic(1, 2)); - LOG(INFO) << intrinsic; intrinsic = getCameraMatrix(screen_->getVR(), vr::Eye_Right); CHECK(intrinsic(0, 2) < 0 && intrinsic(1, 2) < 0); @@ -376,8 +375,9 @@ const GLTexture &ftl::gui::Camera::captureFrame() { if (src_ && src_->isReady()) { UNIQUE_LOCK(mutex_, lk); - if (isVR()) { + if (screen_->isVR()) { #ifdef HAVE_OPENVR + vr::VRCompositor()->WaitGetPoses(rTrackedDevicePose_, vr::k_unMaxTrackedDeviceCount, NULL, 0 ); if ((channel_ == Channel::Right) && rTrackedDevicePose_[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid ) diff --git a/applications/gui/src/media_panel.cpp b/applications/gui/src/media_panel.cpp index c04552fcd2207971e12e9b8e49a04491629ea63f..5967bd320c62d0049747e52ebcba7d490a086c80 100644 --- a/applications/gui/src/media_panel.cpp +++ b/applications/gui/src/media_panel.cpp @@ -149,7 +149,7 @@ MediaPanel::MediaPanel(ftl::gui::Screen *screen) : nanogui::Window(screen, ""), auto button_vr = new Button(this, "VR"); button_vr->setFlags(Button::ToggleButton); button_vr->setChangeCallback([this, button_vr](bool state) { - if (!screen_->useVR()) { + if (!screen_->isVR()) { if (screen_->switchVR(true) == true) { button_vr->setTextColor(nanogui::Color(0.5f,0.5f,1.0f,1.0f)); this->button_channels_->setEnabled(false); diff --git a/applications/gui/src/screen.cpp b/applications/gui/src/screen.cpp index 1ee7425ab27f55108d9fad3edef4c683e945028f..b864c8fe20b1f9eb845738d3c3178775e4b45502 100644 --- a/applications/gui/src/screen.cpp +++ b/applications/gui/src/screen.cpp @@ -319,14 +319,14 @@ bool ftl::gui::Screen::initVR() { return true; } -bool ftl::gui::Screen::useVR() { +bool ftl::gui::Screen::isVR() { auto *cam = activeCamera(); if (HMD_ == nullptr || cam == nullptr) { return false; } return cam->isVR(); } bool ftl::gui::Screen::switchVR(bool on) { - if (useVR() == on) { return on; } + if (isVR() == on) { return on; } if (on && (HMD_ == nullptr) && !initVR()) { return false; @@ -338,7 +338,7 @@ bool ftl::gui::Screen::switchVR(bool on) { activeCamera()->setVR(false); } - return useVR(); + return isVR(); } #endif @@ -466,7 +466,7 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) { if (camera_->getChannel() != ftl::codecs::Channel::Left) { mImageID = rightEye_; } #ifdef HAVE_OPENVR - if (useVR() && imageSize[0] > 0 && camera_->getLeft().isValid() && camera_->getRight().isValid()) { + if (isVR() && imageSize[0] > 0 && camera_->getLeft().isValid() && camera_->getRight().isValid()) { vr::Texture_t leftEyeTexture = {(void*)(uintptr_t)leftEye_, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture ); diff --git a/applications/gui/src/screen.hpp b/applications/gui/src/screen.hpp index a195f4ccdd45500c534039709ba6762fdd640b22..69ce36ba4fd4603ad73c111456e52b543d316cce 100644 --- a/applications/gui/src/screen.hpp +++ b/applications/gui/src/screen.hpp @@ -52,7 +52,7 @@ class Screen : public nanogui::Screen { bool hasVR() const { return has_vr_; } // is VR mode on/off - bool useVR(); + bool isVR(); // toggle VR on/off bool switchVR(bool mode);