From 4511d09b10432a325599c2c7a27768dc7ced595d Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 20 Apr 2017 18:00:31 -0400 Subject: [PATCH] - Correctly detect isRegularRendering flag - Render GUI in the PostDraw function in order render it not on the cubefaces Closes #259 --- modules/onscreengui/onscreenguimodule.cpp | 7 +++++-- src/engine/wrapper/sgctwindowwrapper.cpp | 13 ++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/onscreengui/onscreenguimodule.cpp b/modules/onscreengui/onscreenguimodule.cpp index fc2e1015db..c4096e8726 100644 --- a/modules/onscreengui/onscreenguimodule.cpp +++ b/modules/onscreengui/onscreenguimodule.cpp @@ -120,11 +120,14 @@ OnScreenGUIModule::OnScreenGUIModule() ); OsEng.registerModuleCallback( - OpenSpaceEngine::CallbackOption::Render, + // This is done in the PostDraw phase so that it will render it on top of + // everything else in the case of fisheyes. With this being in the Render callback + // the GUI would be rendered on top of each of the cube faces + OpenSpaceEngine::CallbackOption::PostDraw, [](){ WindowWrapper& wrapper = OsEng.windowWrapper(); bool showGui = wrapper.hasGuiWindow() ? wrapper.isGuiWindow() : true; - if (wrapper.isMaster() && wrapper.isRegularRendering() && showGui ) { + if (wrapper.isMaster() && showGui ) { glm::vec2 mousePosition = wrapper.mousePosition(); //glm::ivec2 drawBufferResolution = _windowWrapper->currentDrawBufferResolution(); glm::ivec2 windowSize = wrapper.currentWindowSize(); diff --git a/src/engine/wrapper/sgctwindowwrapper.cpp b/src/engine/wrapper/sgctwindowwrapper.cpp index 3c6d6b80cf..65824531ce 100644 --- a/src/engine/wrapper/sgctwindowwrapper.cpp +++ b/src/engine/wrapper/sgctwindowwrapper.cpp @@ -156,13 +156,12 @@ int SGCTWindowWrapper::currentNumberOfAaSamples() const { } bool SGCTWindowWrapper::isRegularRendering() const { - // TODO: Needs to implement the nonlinear rendering check ---abock - - // sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr(); - // !w->isUsingFisheyeRendering() does not exist anymore ---abock - // if (_isMaster && !w->isUsingFisheyeRendering() && _console->isVisible()) { - - return true; + sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr(); + std::size_t nViewports = w->getNumberOfViewports(); + ghoul_assert(nViewports > 0, "At least one viewport must exist at this time"); + sgct_core::Viewport* vp = w->getViewport(0); + sgct_core::NonLinearProjection* nlp = vp->getNonLinearProjectionPtr(); + return nlp == nullptr; } bool SGCTWindowWrapper::hasGuiWindow() const {