Skip to content

Commit

Permalink
fix #5042
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Jan 23, 2016
1 parent 8d1f95e commit 93ce1ad
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
43 changes: 18 additions & 25 deletions rts/Game/Game.cpp
Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions rts/Rendering/WorldDrawer.cpp
Expand Up @@ -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();

Expand All @@ -240,6 +251,8 @@ void CWorldDrawer::Draw() const

DrawMiscObjects();
DrawBelowWaterOverlay();

glDisable(GL_FOG);
}


Expand Down Expand Up @@ -411,6 +424,7 @@ void CWorldDrawer::DrawBelowWaterOverlay() const
}

{
// draw water-coloration quad in raw screenspace
ResetMVPMatrices();

glEnableClientState(GL_VERTEX_ARRAY);
Expand Down

0 comments on commit 93ce1ad

Please sign in to comment.