- Correctly detect isRegularRendering flag

- Render GUI in the PostDraw function in order render it not on the cubefaces

Closes #259
This commit is contained in:
Alexander Bock
2017-04-20 18:00:31 -04:00
parent 99a128b945
commit 4511d09b10
2 changed files with 11 additions and 9 deletions

View File

@@ -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();

View File

@@ -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 {