From 93ce1ad5088dbb4edf4f62de4ae2ed51d646f4f7 Mon Sep 17 00:00:00 2001 From: rtri Date: Sat, 23 Jan 2016 19:42:13 +0100 Subject: [PATCH] fix #5042 --- rts/Game/Game.cpp | 43 +++++++++++++++-------------------- rts/Rendering/WorldDrawer.cpp | 14 ++++++++++++ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/rts/Game/Game.cpp b/rts/Game/Game.cpp index ddbf399053c..9912317b015 100644 --- a/rts/Game/Game.cpp +++ b/rts/Game/Game.cpp @@ -1203,42 +1203,35 @@ bool CGame::Draw() { } { + SCOPED_TIMER("Game::DrawWorld"); + minimap->Update(); - if (doDrawWorld) { + if (doDrawWorld) worldDrawer->GenerateIBLTextures(); - } - } - glDepthMask(GL_TRUE); - glEnable(GL_DEPTH_TEST); - glDisable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glClearColor(mapInfo->atmosphere.fogColor[0], mapInfo->atmosphere.fogColor[1], mapInfo->atmosphere.fogColor[2], 0.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - camera->Update(); + camera->Update(); + + if (doDrawWorld) + worldDrawer->Draw(); - if (doDrawWorld) { - worldDrawer->Draw(); - } else { worldDrawer->ResetMVPMatrices(); } - glDisable(GL_FOG); - - SCOPED_TIMER("Game::DrawScreen"); + { + SCOPED_TIMER("Game::DrawScreen"); - if (doDrawWorld) { - eventHandler.DrawScreenEffects(); - } + if (doDrawWorld) + eventHandler.DrawScreenEffects(); - hudDrawer->Draw((gu->GetMyPlayer())->fpsController.GetControllee()); - debugDrawerAI->Draw(); + hudDrawer->Draw((gu->GetMyPlayer())->fpsController.GetControllee()); + debugDrawerAI->Draw(); - DrawInputReceivers(); - DrawInputText(); - DrawInterfaceWidgets(); - mouse->DrawCursor(); + DrawInputReceivers(); + DrawInputText(); + DrawInterfaceWidgets(); + mouse->DrawCursor(); + } glEnable(GL_DEPTH_TEST); glLoadIdentity(); diff --git a/rts/Rendering/WorldDrawer.cpp b/rts/Rendering/WorldDrawer.cpp index 521d74b2943..49c6c24b203 100644 --- a/rts/Rendering/WorldDrawer.cpp +++ b/rts/Rendering/WorldDrawer.cpp @@ -226,6 +226,17 @@ void CWorldDrawer::ResetMVPMatrices() const void CWorldDrawer::Draw() const { SCOPED_TIMER("WorldDrawer::Total"); + + + glClearColor(mapInfo->atmosphere.fogColor[0], mapInfo->atmosphere.fogColor[1], mapInfo->atmosphere.fogColor[2], 0.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + + glDepthMask(GL_TRUE); + glEnable(GL_DEPTH_TEST); + glDisable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + DrawOpaqueObjects(); DrawAlphaObjects(); @@ -240,6 +251,8 @@ void CWorldDrawer::Draw() const DrawMiscObjects(); DrawBelowWaterOverlay(); + + glDisable(GL_FOG); } @@ -411,6 +424,7 @@ void CWorldDrawer::DrawBelowWaterOverlay() const } { + // draw water-coloration quad in raw screenspace ResetMVPMatrices(); glEnableClientState(GL_VERTEX_ARRAY);