Disables depth test for GUI rendering.

Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3835
This was SVN commit r25231.
This commit is contained in:
Vladislav Belov 2021-04-11 19:36:52 +00:00
parent e7159c01fb
commit a6cb77a204
4 changed files with 6 additions and 17 deletions

View File

@ -327,10 +327,6 @@ void CGUI::SendEventToAll(const CStr& eventName, const JS::HandleValueArray& par
void CGUI::Draw() void CGUI::Draw()
{ {
// Clear the depth buffer, so the GUI is
// drawn on top of everything else
glClear(GL_DEPTH_BUFFER_BIT);
using Arena = Allocators::DynamicArena<128 * KiB>; using Arena = Allocators::DynamicArena<128 * KiB>;
using ObjectListAllocator = ProxyAllocator<VisibleObject, Arena>; using ObjectListAllocator = ProxyAllocator<VisibleObject, Arena>;
Arena arena; Arena arena;

View File

@ -131,10 +131,6 @@ void CChart::Draw()
const float width = rect.GetWidth(); const float width = rect.GetWidth();
const float height = rect.GetHeight(); const float height = rect.GetHeight();
// Disable depth updates to prevent apparent z-fighting-related issues
// with some drivers causing units to get drawn behind the texture.
glDepthMask(0);
// Setup the render state // Setup the render state
CMatrix3D transform = GetDefaultGuiMatrix(); CMatrix3D transform = GetDefaultGuiMatrix();
CShaderDefines lineDefines; CShaderDefines lineDefines;
@ -173,9 +169,6 @@ void CChart::Draw()
tech->EndPass(); tech->EndPass();
// Reset depth mask
glDepthMask(1);
for (size_t i = 0; i < m_TextPositions.size(); ++i) for (size_t i = 0; i < m_TextPositions.size(); ++i)
DrawText(i, CGUIColor(1.f, 1.f, 1.f, 1.f), m_TextPositions[i], bz + 0.5f); DrawText(i, CGUIColor(1.f, 1.f, 1.f, 1.f), m_TextPositions[i], bz + 0.5f);
} }

View File

@ -430,9 +430,6 @@ void CMiniMap::Draw()
const float unitScale = (cmpRangeManager->GetLosCircular() ? 1.f : m_MapScale/2.f); const float unitScale = (cmpRangeManager->GetLosCircular() ? 1.f : m_MapScale/2.f);
CLOSTexture& losTexture = g_Game->GetView()->GetLOSTexture(); CLOSTexture& losTexture = g_Game->GetView()->GetLOSTexture();
// Disable depth updates to prevent apparent z-fighting-related issues
// with some drivers causing units to get drawn behind the texture.
glDepthMask(0);
CShaderProgramPtr shader; CShaderProgramPtr shader;
CShaderTechniquePtr tech; CShaderTechniquePtr tech;
@ -634,9 +631,6 @@ void CMiniMap::Draw()
DrawViewRect(unitMatrix); DrawViewRect(unitMatrix);
PROFILE_END("minimap units"); PROFILE_END("minimap units");
// Reset depth mask
glDepthMask(1);
} }
void CMiniMap::CreateTextures() void CMiniMap::CreateTextures()

View File

@ -254,7 +254,13 @@ void Render()
ogl_WarnIfError(); ogl_WarnIfError();
if (g_DoRenderGui) if (g_DoRenderGui)
{
// All GUI elements are drawn in Z order to render semi-transparent
// objects correctly.
glDisable(GL_DEPTH_TEST);
g_GUI->Draw(); g_GUI->Draw();
glEnable(GL_DEPTH_TEST);
}
ogl_WarnIfError(); ogl_WarnIfError();