}
else
{
- // use the bufferobject if all triangles are accepted
- usebufferobject = true;
batchnumtriangles = 0;
batchfirsttriangle = surface->num_firsttriangle;
for (l = k;l < kend;l++)
{
r_refdef.stats.lights_lighttriangles += batchnumtriangles;
Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
- if (usebufferobject && batchnumtriangles >= 100)
+ // use the element buffer if all triangles are consecutive
+ if (m == batchfirsttriangle + batchnumtriangles)
R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, ent->model->surfmesh.ebo, sizeof(int[3]) * batchfirsttriangle);
else
R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, 0, 0);
{
r_refdef.stats.lights_lighttriangles += batchnumtriangles;
Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
- if (usebufferobject && batchnumtriangles >= 100)
+ // use the element buffer if all triangles are consecutive
+ if (m == batchfirsttriangle + batchnumtriangles)
R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, ent->model->surfmesh.ebo, sizeof(int[3]) * batchfirsttriangle);
else
R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, 0, 0);