diff --git a/src/gl/scene/gl_decal.cpp b/src/gl/scene/gl_decal.cpp index 1d15ebcab2..61c92d3fdb 100644 --- a/src/gl/scene/gl_decal.cpp +++ b/src/gl/scene/gl_decal.cpp @@ -45,6 +45,7 @@ #include "gl/system/gl_cvars.h" #include "gl/data/gl_data.h" +#include "gl/data/gl_vertexbuffer.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_lightdata.h" #include "gl/renderer/gl_renderstate.h" @@ -336,13 +337,28 @@ void GLWall::DrawDecal(DBaseDecal *decal) else gl_RenderState.AlphaFunc(GL_GREATER, 0.f); gl_RenderState.Apply(); - glBegin(GL_TRIANGLE_FAN); - for(i=0;i<4;i++) + if (!gl_usevbo) { - glTexCoord2f(dv[i].u,dv[i].v); - glVertex3f(dv[i].x,dv[i].z,dv[i].y); + glBegin(GL_TRIANGLE_FAN); + for (i = 0; i < 4; i++) + { + glTexCoord2f(dv[i].u, dv[i].v); + glVertex3f(dv[i].x, dv[i].z, dv[i].y); + } + glEnd(); + } + else + { + 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++; + } + unsigned int offset; + unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); + glDrawArrays(GL_TRIANGLE_FAN, offset, count); } - glEnd(); rendered_decals++; gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.SetObjectColor(0xffffffff); diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 7be264e68d..4d3f4c3f6e 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -153,14 +153,14 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass) // Render the light glBegin(GL_TRIANGLE_FAN); - for(k = 0, v = sub->firstline; k < sub->numlines; k++, v++) + for (k = 0, v = sub->firstline; k < sub->numlines; k++, v++) { vertex_t *vt = v->v1; float zc = plane.plane.ZatPoint(vt->fx, vt->fy) + dz; t1.Set(vt->fx, zc, vt->fy); Vector nearToVert = t1 - nearPt; - glTexCoord2f( (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f); + glTexCoord2f((nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f); glVertex3f(vt->fx, zc, vt->fy); }