diff --git a/src/lava-vr/VRImgui.cc b/src/lava-vr/VRImgui.cc index c01399998f7da1ed8aaae07ed8aac97ebfc48c68..ca457ab286067c9c78b7197b03d7395fce8071ef 100644 --- a/src/lava-vr/VRImgui.cc +++ b/src/lava-vr/VRImgui.cc @@ -112,6 +112,7 @@ void VRImgui::update(const glm::mat4 &screenPose, vmouse.z *= mHeight * pixels_per_meter; mVMouse = vmouse; + mImgui->makeCurrent(); auto& io = ::ImGui::GetIO(); if (pointer.y > -0.1f && pointer.y < 0.1f) { @@ -153,7 +154,7 @@ bool VRImgui::visible() const bool VRImgui::enabled() const { - return mCurrentOpacity > 0.5f && mTargetOpacity > 0.5f; + return !mBlocked && mCurrentOpacity > 0.5f && mTargetOpacity > 0.5f; } } // namespace vr diff --git a/src/lava-vr/VRImgui.hh b/src/lava-vr/VRImgui.hh index 157cc69d4780932551eae3177600b33643dcc70a..408670fbf33b93c2934fc5e4918c2f4c7e4b384a 100644 --- a/src/lava-vr/VRImgui.hh +++ b/src/lava-vr/VRImgui.hh @@ -47,9 +47,11 @@ class VRImgui { /// you can skip recording widgets if this returns false bool visible() const; - /// returns true if the ImGui is accepting input (due to fading state) + /// returns true if the ImGui is accepting input (due to fading state, or being blocked) bool enabled() const; + void setBlocked(bool val) { mBlocked = val; }; + protected: SharedGraphicsPipeline mPipeline; SharedDescriptorSet mDescriptor; @@ -57,6 +59,7 @@ class VRImgui { float mCurrentOpacity = 1.0f, mTargetOpacity = 1.0f; glm::mat4 mPose; glm::vec3 mVMouse; + bool mBlocked = false; imgui::UniqueImGui mImgui; };