Permalink
Browse files

OpenGL Renderer: Fix a bug where the behavior of translucent polygons…

… can become undefined if the frame contains nothing but translucent polygons. Fixes a graphical glitch in Grey's intro scene in Mega Man ZX Advent. (Regression from commit 1742114.)
  • Loading branch information...
rogerman committed Sep 24, 2017
1 parent 1742114 commit 70c69a46d3d1f3e3ce0d03e0f7e38f6f6d086bbe
Showing with 11 additions and 2 deletions.
  1. +11 −2 desmume/src/OGLRender.cpp
View
@@ -3693,17 +3693,22 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry(const GFX3D_State &renderState,
const POLY &firstPoly = polyList->list[indexList->list[0]];
u32 lastPolyAttr = firstPoly.polyAttr;
this->SetupPolygon(firstPoly, false, true);
if (polyList->opaqueCount > 0)
{
this->SetupPolygon(firstPoly, false, true);
this->DrawPolygonsForIndexRange<OGLPolyDrawMode_DrawOpaquePolys>(polyList, indexList, 0, polyList->opaqueCount - 1, indexOffset, lastPolyAttr);
}
if (polyList->opaqueCount < polyList->count)
{
if (this->_needsZeroDstAlphaPass)
{
if (polyList->opaqueCount == 0)
{
this->SetupPolygon(firstPoly, true, false);
}
this->ZeroDstAlphaPass(polyList, indexList, renderState.enableAlphaBlending, indexOffset, lastPolyAttr);
if (polyList->opaqueCount > 0)
@@ -3712,7 +3717,11 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry(const GFX3D_State &renderState,
lastPolyAttr = lastOpaquePoly.polyAttr;
this->SetupPolygon(lastOpaquePoly, false, true);
}
}
if (polyList->opaqueCount == 0)
{
this->SetupPolygon(firstPoly, true, true);
}
this->DrawPolygonsForIndexRange<OGLPolyDrawMode_DrawTranslucentPolys>(polyList, indexList, polyList->opaqueCount, polyList->count - 1, indexOffset, lastPolyAttr);

0 comments on commit 70c69a4

Please sign in to comment.