Skip to content

Commit

Permalink
#5893: Fix crash when rendering shaders without materials in lighting…
Browse files Browse the repository at this point in the history
… mode.

Fix GL program state leak which caused the ortho view grid to appear black
  • Loading branch information
codereader committed Jan 28, 2022
1 parent 8ca921b commit 03bcfae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions radiantcore/rendersystem/OpenGLRenderSystem.cpp
Expand Up @@ -246,6 +246,11 @@ void OpenGLRenderSystem::setupViewMatrices(const Matrix4& modelview, const Matri

void OpenGLRenderSystem::finishRendering()
{
if (GLEW_ARB_shader_objects)
{
glUseProgramObjectARB(0);
}

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
Expand Down
5 changes: 4 additions & 1 deletion radiantcore/rendersystem/backend/LightInteractions.cpp
Expand Up @@ -105,7 +105,10 @@ void LightInteractions::fillDepthBuffer(OpenGLState& state, RenderStateFlags glo
auto& surfaceList = pair.second;

// Skip translucent materials
if (shader->getMaterial()->getCoverage() == Material::MC_TRANSLUCENT) continue;
if (shader->getMaterial() && shader->getMaterial()->getCoverage() == Material::MC_TRANSLUCENT)
{
continue;
}

if (!shader->getDepthFillPass()) continue;

Expand Down

0 comments on commit 03bcfae

Please sign in to comment.