diff --git a/src/gl/data/gl_vertexbuffer.h b/src/gl/data/gl_vertexbuffer.h index 013e6d73ae..80db0d64ea 100644 --- a/src/gl/data/gl_vertexbuffer.h +++ b/src/gl/data/gl_vertexbuffer.h @@ -70,6 +70,14 @@ public: mCurIndex = newofs; return diff; } +#ifdef __GL_PCH_H // we need the system includes for this but we cannot include them ourselves without creating #define clashes. The affected files wouldn't try to draw anyway. + void RenderCurrent(FFlatVertex *newptr, unsigned int primtype) + { + unsigned int offset; + unsigned int count = GetCount(newptr, &offset); + glDrawArrays(primtype, offset, count); + } +#endif void Reset() { mCurIndex = mIndex; diff --git a/src/gl/scene/gl_decal.cpp b/src/gl/scene/gl_decal.cpp index 61c92d3fdb..8f2e7977ae 100644 --- a/src/gl/scene/gl_decal.cpp +++ b/src/gl/scene/gl_decal.cpp @@ -355,9 +355,7 @@ void GLWall::DrawDecal(DBaseDecal *decal) 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); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } rendered_decals++; gl_RenderState.SetTextureMode(TM_MODULATE); diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index e0e6cf8dfd..fc44c7896f 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -1011,9 +1011,7 @@ void FDrawInfo::SetupFloodStencil(wallseg * ws) ptr++; ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0); ptr++; - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } glStencilFunc(GL_EQUAL,recursion+1,~0); // draw sky into stencil @@ -1055,9 +1053,7 @@ void FDrawInfo::ClearFloodStencil(wallseg * ws) ptr++; ptr->Set(ws->x2, ws->z1, ws->y2, 0, 0); ptr++; - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } // restore old stencil op. @@ -1158,9 +1154,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo ptr++; ptr->Set(px4, planez, py4, px4 / 64, -py4 / 64); ptr++; - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } if (pushed) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 4d3f4c3f6e..71bb2197b4 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -295,9 +295,7 @@ void GLFlat::DrawSubsector(subsector_t * sub) ptr++; } } - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); } flatvertices += sub->numlines; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 809a516e78..15f9444d41 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -637,9 +637,7 @@ static void FillScreen() ptr++; ptr->Set((float)SCREENWIDTH, (float)SCREENHEIGHT, 0, 0, 0); ptr++; - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP); } } diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index ca32e98a60..98ae66800d 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -302,9 +302,7 @@ void GLWall::RenderWall(int textured, float * color2, ADynamicLight * light) ptr->Set(glseg.x2, zbottom[1], glseg.y2, tcs[3].u, tcs[3].v); ptr++; if (split && !(flags & GLWF_NOSPLITLOWER)) SplitLowerEdge(tcs, ptr); - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_FAN, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN); vertexcount += 4; } diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index 5fca4bb490..a91fa252f1 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -174,9 +174,7 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed ptr++; ptr->Set(x2, y2, 0, fU2, fV2); ptr++; - unsigned int offset; - unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset); - glDrawArrays(GL_TRIANGLE_STRIP, offset, count); + GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP); } if (tex->GetTransparent() || OverrideShader != 0) {