From b672d9b762355b3198254915b28273d5a7e34f74 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 29 Jan 2008 01:50:40 +0000 Subject: [PATCH] fixed VBO batching bug in rtlight rendering git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8035 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rsurf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gl_rsurf.c b/gl_rsurf.c index 68ec5e3d..76f4782c 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -1103,8 +1103,6 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface } else { - // use the bufferobject if all triangles are accepted - usebufferobject = true; batchnumtriangles = 0; batchfirsttriangle = surface->num_firsttriangle; for (l = k;l < kend;l++) @@ -1133,7 +1131,8 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface { 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); @@ -1151,7 +1150,8 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface { 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); -- 2.39.2