From 9453a8a7e6dd952c9932a3bce823b2ef42dec03d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 1 Feb 2016 21:50:55 +0100 Subject: [PATCH] - reuse the same vertex buffer data for all slices of a decal. --- src/gl/scene/gl_decal.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/gl/scene/gl_decal.cpp b/src/gl/scene/gl_decal.cpp index 8bd5dd7a4..df9ae6e3d 100644 --- a/src/gl/scene/gl_decal.cpp +++ b/src/gl/scene/gl_decal.cpp @@ -327,20 +327,23 @@ void GLWall::DrawDecal(DBaseDecal *decal) { gl_RenderState.SetFog(0,-1); } - + + FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer(); + for (i = 0; i < 4; i++) + { + ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v); + ptr++; + } + if (lightlist == NULL) { gl_RenderState.Apply(); - FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer(); - for (i = 0; i < 4; i++) - { - ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v); - ptr++; - } GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } else { + unsigned int offset; + unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); for (unsigned k = 0; k < lightlist->Size(); k++) { secplane_t &lowplane = k == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[k + 1].plane; @@ -360,13 +363,7 @@ void GLWall::DrawDecal(DBaseDecal *decal) gl_RenderState.SetSplitPlanes((*lightlist)[k].plane, lowplane); gl_RenderState.Apply(); - FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer(); - for (i = 0; i < 4; i++) - { - ptr->Set(dv[i].x, dv[i].z, dv[i].y, dv[i].u, dv[i].v); - ptr++; - } - GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); + GLRenderer->mVBO->RenderArray(GL_TRIANGLE_FAN, offset, count); } if (low1 <= dv[0].z && low2 <= dv[3].z) break; }