From 76d7b52fcdbbb7d27f1e02606fb7988563ae58f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Aug 2016 23:20:23 +0200 Subject: [PATCH] - handle the case where a wall gets drawn with an unmapped buffer and no vertex data. This uses the quad drawer because it can only happen with translucent walls that got split during sorting. --- src/gl/scene/gl_walls_draw.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index a8ae5fc794..585ced1a8f 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -60,6 +60,7 @@ #include "gl/textures/gl_material.h" #include "gl/utility/gl_clock.h" #include "gl/utility/gl_templates.h" +#include "gl/renderer/gl_quaddrawer.h" EXTERN_CVAR(Bool, gl_seamless) @@ -213,6 +214,20 @@ void GLWall::RenderWall(int textured) { MakeVertices(!(textured&RWF_NOSPLIT)); } + else if (vertcount == 0) + { + // in case we get here without valid vertex data and no ability to create them now, + // use the quad drawer as fallback (without edge splitting.) + // This can only happen in one special situation, when a translucent line got split during sorting. + FQuadDrawer qd; + qd.Set(0, glseg.x1, zbottom[0], glseg.y1, tcs[LOLFT].u, tcs[LOLFT].v); + qd.Set(1, glseg.x1, ztop[0], glseg.y1, tcs[UPLFT].u, tcs[UPLFT].v); + qd.Set(2, glseg.x2, ztop[1], glseg.y2, tcs[UPRGT].u, tcs[UPRGT].v); + qd.Set(3, glseg.x2, zbottom[1], glseg.y2, tcs[LORGT].u, tcs[LORGT].v); + qd.Render(GL_TRIANGLE_FAN); + vertexcount += 4; + return; + } GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, vertindex, vertcount); vertexcount += vertcount; }