From 37b4fe51665decb0b4ec9841f7fdc4377947c3fc Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 5 Sep 2014 14:16:12 -0700 Subject: [PATCH] Fix for deferred lighting/ambient occlusion when glow effect is disabled. --- interface/src/Application.cpp | 19 ++++--------------- interface/src/renderer/GlowEffect.cpp | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3f7ee7a776..b33f2d3d9d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -589,8 +589,6 @@ void Application::paintGL() { bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); PerformanceWarning warn(showWarnings, "Application::paintGL()"); - const bool glowEnabled = Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect); - // Set the desired FBO texture size. If it hasn't changed, this does nothing. // Otherwise, it must rebuild the FBOs if (OculusManager::isConnected()) { @@ -665,16 +663,11 @@ void Application::paintGL() { updateShadowMap(); } - //If we aren't using the glow shader, we have to clear the color and depth buffer - if (!glowEnabled) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } else if (OculusManager::isConnected()) { + if (OculusManager::isConnected()) { //Clear the color buffer to ensure that there isnt any residual color //Left over from when OR was not connected. glClear(GL_COLOR_BUFFER_BIT); - } - - if (OculusManager::isConnected()) { + //When in mirror mode, use camera rotation. Otherwise, use body rotation if (whichCamera.getMode() == CAMERA_MODE_MIRROR) { OculusManager::display(whichCamera.getRotation(), whichCamera.getPosition(), whichCamera); @@ -687,9 +680,7 @@ void Application::paintGL() { TV3DManager::display(whichCamera); } else { - if (glowEnabled) { - _glowEffect.prepare(); - } + _glowEffect.prepare(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -697,9 +688,7 @@ void Application::paintGL() { displaySide(whichCamera); glPopMatrix(); - if (glowEnabled) { - _glowEffect.render(); - } + _glowEffect.render(); if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) { renderRearViewMirror(_mirrorViewRect); diff --git a/interface/src/renderer/GlowEffect.cpp b/interface/src/renderer/GlowEffect.cpp index 1fdebb66d7..8341bb960c 100644 --- a/interface/src/renderer/GlowEffect.cpp +++ b/interface/src/renderer/GlowEffect.cpp @@ -140,7 +140,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) { QOpenGLFramebufferObject* destFBO = toTexture ? Application::getInstance()->getTextureCache()->getSecondaryFramebufferObject() : NULL; - if (_isEmpty && _renderMode != DIFFUSE_ADD_MODE) { + if (!Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect) || (_isEmpty && _renderMode != DIFFUSE_ADD_MODE)) { // copy the primary to the screen if (QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) { QOpenGLFramebufferObject::blitFramebuffer(destFBO, primaryFBO);