From: havoc Date: Thu, 27 Jun 2013 06:20:52 +0000 (+0000) Subject: fix severe (crashing) bugs with two calls to qglDrawElements when using X-Git-Tag: xonotic-v0.8.0~177 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=21a8b727a5bbc5ef0c7e7a48c49a16163e8cd50e;p=xonotic%2Fdarkplaces.git fix severe (crashing) bugs with two calls to qglDrawElements when using index buffers (this bug was hidden by gl_mesh_drawrangeelements being 1 by default) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11961 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=48aa8723e4e82f2329a6053f95075af8cbf37444 --- diff --git a/gl_backend.c b/gl_backend.c index 81e71c3b..a03060c1 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -3112,7 +3112,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri else #endif { - qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_SHORT, (void *)(firsttriangle * sizeof(unsigned short[3]))); + qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_SHORT, (void *)bufferoffset3s); CHECKGLERROR } } @@ -3128,7 +3128,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri else #endif { - qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, (void *)(firsttriangle * sizeof(unsigned int[3]))); + qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, (void *)bufferoffset3i); CHECKGLERROR } }