]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added bufferobject and bufferoffset parameters to all R_Mesh_*Pointer functions and...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Apr 2007 10:18:14 +0000 (10:18 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Apr 2007 10:18:14 +0000 (10:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7043 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c
cl_screen.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_rmain.c
gl_rsurf.c
r_explosion.c
r_lightning.c
r_shadow.c
r_sky.c

index 86e715876a6e56ebedc8e671b3a90f38decc202b..fb1c128284e49a56ccf3788955171b7f452eee07 100644 (file)
@@ -2125,9 +2125,9 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
 
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
-       R_Mesh_VertexPointer(particle_vertex3f);
-       R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f);
-       R_Mesh_ColorPointer(particle_color4f);
+       R_Mesh_VertexPointer(particle_vertex3f, 0, 0);
+       R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f, 0, 0);
+       R_Mesh_ColorPointer(particle_color4f, 0, 0);
        GL_DepthMask(false);
        GL_DepthTest(true);
        GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
@@ -2282,7 +2282,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                if (blendmode != p->type->blendmode)
                {
                        if (batchcount > 0)
-                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
                        batchcount = 0;
                        batchstart = surfacelistindex;
                        blendmode = p->type->blendmode;
@@ -2296,7 +2296,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                if (texture != particletexture[p->texnum].texture)
                {
                        if (batchcount > 0)
-                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
                        batchcount = 0;
                        batchstart = surfacelistindex;
                        texture = particletexture[p->texnum].texture;
@@ -2306,7 +2306,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                batchcount++;
        }
        if (batchcount > 0)
-               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
        GL_LockArrays(0, 0);
 }
 
index 5ec0656f1db607c869c59f4b7fafa95e338842ba..581852aaa460e50d695cdc72a0e5761eafd08c67 100644 (file)
@@ -1648,11 +1648,11 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        GL_Color(1,1,1,1);
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        GL_DepthTest(false);
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        R_Mesh_TexBind(0, R_GetTexture(pic->tex));
-       R_Mesh_TexCoordPointer(0, 2, texcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
        vertex3f[2] = vertex3f[5] = vertex3f[8] = vertex3f[11] = 0;
        vertex3f[0] = vertex3f[9] = x;
        vertex3f[1] = vertex3f[4] = y;
@@ -1665,14 +1665,14 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        if (vid.stereobuffer)
        {
                qglDrawBuffer(GL_FRONT_LEFT);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                qglDrawBuffer(GL_FRONT_RIGHT);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
        }
        else
        {
                qglDrawBuffer(GL_FRONT);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
        }
        R_Mesh_Finish();
        // refresh
index b8e255d9872518d187771fa4f91e7731dcae419f..70af0a43c482717a30a24b54a005951fbeeefe8a 100644 (file)
@@ -867,10 +867,8 @@ void GL_Backend_RenumberElements(int *out, int count, const int *in, int offset)
 
 // renders triangles using vertices from the active arrays
 int paranoidblah = 0;
-void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements)
+void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements, int bufferobject, size_t bufferoffset)
 {
-       int bufferobject = 0;
-       size_t offset = 0;
        unsigned int numelements = numtriangles * 3;
        if (numvertices < 3 || numtriangles < 1)
        {
@@ -1014,13 +1012,13 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *
                else if (gl_mesh_drawrangeelements.integer && qglDrawRangeElements != NULL)
                {
                        GL_BindEBO(bufferobject);
-                       qglDrawRangeElements(GL_TRIANGLES, firstvertex, firstvertex + numvertices, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)offset : elements);
+                       qglDrawRangeElements(GL_TRIANGLES, firstvertex, firstvertex + numvertices, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)bufferoffset : elements);
                        CHECKGLERROR
                }
                else
                {
                        GL_BindEBO(bufferobject);
-                       qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)offset : elements);
+                       qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, bufferobject ? (void *)bufferoffset : elements);
                        CHECKGLERROR
                }
        }
@@ -1096,25 +1094,21 @@ void R_Mesh_Matrix(const matrix4x4_t *matrix)
        }
 }
 
-void R_Mesh_VertexPointer(const float *vertex3f)
+void R_Mesh_VertexPointer(const float *vertex3f, int bufferobject, size_t bufferoffset)
 {
-       int bufferobject = 0;
-       size_t offset = 0;
-       if (gl_state.pointer_vertex != vertex3f || gl_state.pointer_vertex_buffer != bufferobject || gl_state.pointer_vertex_offset != offset)
+       if (gl_state.pointer_vertex != vertex3f || gl_state.pointer_vertex_buffer != bufferobject || gl_state.pointer_vertex_offset != bufferoffset)
        {
                gl_state.pointer_vertex = vertex3f;
                gl_state.pointer_vertex_buffer = bufferobject;
-               gl_state.pointer_vertex_offset = offset;
+               gl_state.pointer_vertex_offset = bufferoffset;
                CHECKGLERROR
                GL_BindVBO(bufferobject);
-               qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), bufferobject ? (void *)offset : vertex3f);CHECKGLERROR
+               qglVertexPointer(3, GL_FLOAT, sizeof(float[3]), bufferobject ? (void *)bufferoffset : vertex3f);CHECKGLERROR
        }
 }
 
-void R_Mesh_ColorPointer(const float *color4f)
+void R_Mesh_ColorPointer(const float *color4f, int bufferobject, size_t bufferoffset)
 {
-       int bufferobject = 0;
-       size_t offset = 0;
        if (color4f || bufferobject)
        {
                // caller wants color array enabled
@@ -1124,14 +1118,14 @@ void R_Mesh_ColorPointer(const float *color4f)
                        CHECKGLERROR
                        qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
                }
-               if (gl_state.pointer_color != color4f || gl_state.pointer_color_buffer != bufferobject || gl_state.pointer_color_offset != offset)
+               if (gl_state.pointer_color != color4f || gl_state.pointer_color_buffer != bufferobject || gl_state.pointer_color_offset != bufferoffset)
                {
                        gl_state.pointer_color = color4f;
                        gl_state.pointer_color_buffer = bufferobject;
-                       gl_state.pointer_color_offset = offset;
+                       gl_state.pointer_color_offset = bufferoffset;
                        CHECKGLERROR
                        GL_BindVBO(bufferobject);
-                       qglColorPointer(4, GL_FLOAT, sizeof(float[4]), bufferobject ? (void *)offset : color4f);CHECKGLERROR
+                       qglColorPointer(4, GL_FLOAT, sizeof(float[4]), bufferobject ? (void *)bufferoffset : color4f);CHECKGLERROR
                }
        }
        else
@@ -1148,10 +1142,8 @@ void R_Mesh_ColorPointer(const float *color4f)
        }
 }
 
-void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord)
+void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord, int bufferobject, size_t bufferoffset)
 {
-       int bufferobject = 0;
-       size_t offset;
        gltextureunit_t *unit = gl_state.units + unitnum;
        // update array settings
        CHECKGLERROR
@@ -1165,15 +1157,15 @@ void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, co
                        qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
                }
                // texcoord array
-               if (unit->pointer_texcoord != texcoord || unit->pointer_texcoord_buffer != bufferobject || unit->pointer_texcoord_offset != offset || unit->arraycomponents != numcomponents)
+               if (unit->pointer_texcoord != texcoord || unit->pointer_texcoord_buffer != bufferobject || unit->pointer_texcoord_offset != bufferoffset || unit->arraycomponents != numcomponents)
                {
                        unit->pointer_texcoord = texcoord;
                        unit->pointer_texcoord_buffer = bufferobject;
-                       unit->pointer_texcoord_offset = offset;
+                       unit->pointer_texcoord_offset = bufferoffset;
                        unit->arraycomponents = numcomponents;
                        GL_ClientActiveTexture(unitnum);
                        GL_BindVBO(bufferobject);
-                       qglTexCoordPointer(unit->arraycomponents, GL_FLOAT, sizeof(float) * unit->arraycomponents, bufferobject ? (void *)offset : texcoord);CHECKGLERROR
+                       qglTexCoordPointer(unit->arraycomponents, GL_FLOAT, sizeof(float) * unit->arraycomponents, bufferobject ? (void *)bufferoffset : texcoord);CHECKGLERROR
                }
        }
        else
@@ -1688,9 +1680,9 @@ void R_Mesh_TextureState(const rmeshstate_t *m)
        for (i = 0;i < backendarrayunits;i++)
        {
                if (m->pointer_texcoord3f[i])
-                       R_Mesh_TexCoordPointer(i, 3, m->pointer_texcoord3f[i]);
+                       R_Mesh_TexCoordPointer(i, 3, m->pointer_texcoord3f[i], 0, 0);
                else
-                       R_Mesh_TexCoordPointer(i, 2, m->pointer_texcoord[i]);
+                       R_Mesh_TexCoordPointer(i, 2, m->pointer_texcoord[i], 0, 0);
        }
        for (i = 0;i < backendunits;i++)
        {
index 247924892d070fb96edeb9719ca0fb58fcd3c5e5..ba2e646a3cf39107899b3b9ddef5555dbd0282d8 100644 (file)
@@ -72,11 +72,11 @@ void R_Mesh_Finish(void);
 // sets up the requested vertex transform matrix
 void R_Mesh_Matrix(const matrix4x4_t *matrix);
 // sets the vertex array pointer
-void R_Mesh_VertexPointer(const float *vertex3f);
+void R_Mesh_VertexPointer(const float *vertex3f, int bufferobject, size_t bufferoffset);
 // sets the color array pointer (GL_Color only works when this is NULL)
-void R_Mesh_ColorPointer(const float *color4f);
+void R_Mesh_ColorPointer(const float *color4f, int bufferobject, size_t bufferoffset);
 // sets the texcoord array pointer for an array unit
-void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord);
+void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord, int bufferobject, size_t bufferoffset);
 // sets all textures bound to an image unit (multiple can be non-zero at once, according to OpenGL rules the highest one overrides the others)
 void R_Mesh_TexBindAll(unsigned int unitnum, int tex1d, int tex2d, int tex3d, int texcubemap);
 // sets these are like TexBindAll with only one of the texture indices non-zero
@@ -95,7 +95,7 @@ void R_Mesh_TextureState(const rmeshstate_t *m);
 void R_Mesh_ResetTextureState(void);
 
 // renders a mesh
-void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements);
+void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int *elements, int bufferobject, size_t bufferoffset);
 // renders a mesh as lines
 void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, const int *elements);
 
index 9b13f17d079a691a41fa9135037177a7da5bcd43..17883ca217202990b505f020c816b613ea54f4a0 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -594,11 +594,11 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
 
        GL_Color(red, green, blue, alpha);
 
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        R_Mesh_TexBind(0, R_GetTexture(char_texture));
-       R_Mesh_TexCoordPointer(0, 2, texcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
 
        at = texcoord2f;
        av = vertex3f;
@@ -629,7 +629,7 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
                if (batchcount >= QUADELEMENTS_MAXQUADS)
                {
                        GL_LockArrays(0, batchcount * 4);
-                       R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+                       R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements, 0, 0);
                        GL_LockArrays(0, 0);
                        batchcount = 0;
                        at = texcoord2f;
@@ -639,7 +639,7 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
        if (batchcount > 0)
        {
                GL_LockArrays(0, batchcount * 4);
-               R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+               R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements, 0, 0);
                GL_LockArrays(0, 0);
        }
 }
@@ -782,8 +782,8 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
 
        _DrawQ_ProcessDrawFlag(flags);
 
-       R_Mesh_VertexPointer(floats);
-       R_Mesh_ColorPointer(floats + 20);
+       R_Mesh_VertexPointer(floats, 0, 0);
+       R_Mesh_ColorPointer(floats + 20, 0, 0);
        R_Mesh_ResetTextureState();
        if (pic)
        {
@@ -792,7 +792,7 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
                if (height == 0)
                        height = pic->height;
                R_Mesh_TexBind(0, R_GetTexture(pic->tex));
-               R_Mesh_TexCoordPointer(0, 2, floats + 12);
+               R_Mesh_TexCoordPointer(0, 2, floats + 12, 0, 0);
                floats[12] = s1;floats[13] = t1;
                floats[14] = s2;floats[15] = t2;
                floats[16] = s4;floats[17] = t4;
@@ -809,21 +809,21 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
        floats[28] = r4;floats[29] = g4;floats[30] = b4;floats[31] = a4;
        floats[32] = r3;floats[33] = g3;floats[34] = b3;floats[35] = a3;
 
-       R_Mesh_Draw(0, 4, 2, polygonelements);
+       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
 }
 
 void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
 {
        _DrawQ_ProcessDrawFlag(flags);
 
-       R_Mesh_VertexPointer(mesh->data_vertex3f);
-       R_Mesh_ColorPointer(mesh->data_color4f);
+       R_Mesh_VertexPointer(mesh->data_vertex3f, 0, 0);
+       R_Mesh_ColorPointer(mesh->data_color4f, 0, 0);
        R_Mesh_ResetTextureState();
        R_Mesh_TexBind(0, R_GetTexture(mesh->texture));
-       R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f, 0, 0);
 
        GL_LockArrays(0, mesh->num_vertices);
-       R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+       R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, 0, 0);
        GL_LockArrays(0, 0);
 }
 
@@ -892,8 +892,8 @@ void R_DrawGamma(void)
        if (!vid_usinghwgamma)
        {
                // all the blends ignore depth
-               R_Mesh_VertexPointer(blendvertex3f);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_VertexPointer(blendvertex3f, 0, 0);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                R_Mesh_ResetTextureState();
                GL_DepthMask(true);
                GL_DepthTest(false);
@@ -911,7 +911,7 @@ void R_DrawGamma(void)
                        while (c[0] >= 1.01f || c[1] >= 1.01f || c[2] >= 1.01f)
                        {
                                GL_Color(bound(0, c[0] - 1, 1), bound(0, c[1] - 1, 1), bound(0, c[2] - 1, 1), 1);
-                               R_Mesh_Draw(0, 3, 1, polygonelements);
+                               R_Mesh_Draw(0, 3, 1, polygonelements, 0, 0);
                                VectorScale(c, 0.5, c);
                        }
                }
@@ -927,7 +927,7 @@ void R_DrawGamma(void)
                {
                        GL_BlendFunc(GL_ONE, GL_ONE);
                        GL_Color(c[0], c[1], c[2], 1);
-                       R_Mesh_Draw(0, 3, 1, polygonelements);
+                       R_Mesh_Draw(0, 3, 1, polygonelements, 0, 0);
                }
        }
 }
index afcccccd97f953376f6ffb3b49311c16b16421b2..12be21aa5b6555315dc939a2db233a49523101a8 100644 (file)
@@ -1816,9 +1816,9 @@ void R_Bloom_CopyScreenTexture(float colorscale)
        r_refdef.stats.bloom++;
 
        R_ResetViewRendering2D();
-       R_Mesh_VertexPointer(r_screenvertex3f);
-       R_Mesh_ColorPointer(NULL);
-       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f);
+       R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
+       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
        R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_screen));
 
        // copy view into the screen texture
@@ -1833,7 +1833,7 @@ void R_Bloom_CopyScreenTexture(float colorscale)
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_Color(colorscale, colorscale, colorscale, 1);
        // TODO: optimize with multitexture or GLSL
-       R_Mesh_Draw(0, 4, 2, polygonelements);
+       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
        r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
 
        // we now have a bloom image in the framebuffer
@@ -1862,8 +1862,8 @@ void R_Bloom_MakeTexture(void)
        r_refdef.stats.bloom++;
 
        R_ResetViewRendering2D();
-       R_Mesh_VertexPointer(r_screenvertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
 
        // we have a bloom image in the framebuffer
        CHECKGLERROR
@@ -1876,8 +1876,8 @@ void R_Bloom_MakeTexture(void)
                GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
                GL_Color(r, r, r, 1);
                R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
-               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
 
                // copy the vertically blurred bloom view to a texture
@@ -1892,7 +1892,7 @@ void R_Bloom_MakeTexture(void)
        if (r_hdr.integer)
                brighten *= r_hdr_range.value;
        R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
-       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.offsettexcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.offsettexcoord2f, 0, 0);
 
        for (dir = 0;dir < 2;dir++)
        {
@@ -1921,7 +1921,7 @@ void R_Bloom_MakeTexture(void)
                        //r = (dir ? 1.0f : brighten)/(range*2+1);
                        r = (dir ? 1.0f : brighten)/(range*2+1)*(1 - x*x/(float)(range*range));
                        GL_Color(r, r, r, 1);
-                       R_Mesh_Draw(0, 4, 2, polygonelements);
+                       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                        r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
                        GL_BlendFunc(GL_ONE, GL_ONE);
                }
@@ -1939,17 +1939,17 @@ void R_Bloom_MakeTexture(void)
        {
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
-               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
                GL_Color(1, 1, 1, 1);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
 
                GL_BlendFunc(GL_ONE, GL_ONE);
                qglBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
                R_Mesh_TexBind(0, R_GetTexture(r_texture_white));
-               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
                GL_Color(r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, r_bloom_colorsubtract.value, 1);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                r_refdef.stats.bloom_drawpixels += r_bloomstate.bloomwidth * r_bloomstate.bloomheight;
                qglBlendEquationEXT(GL_FUNC_ADD_EXT);
 
@@ -2005,13 +2005,13 @@ static void R_BlendView(void)
                // the bloom texture was made earlier this render, so we just need to
                // blend it onto the screen...
                R_ResetViewRendering2D();
-               R_Mesh_VertexPointer(r_screenvertex3f);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                GL_Color(1, 1, 1, 1);
                GL_BlendFunc(GL_ONE, GL_ONE);
                R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
-               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                r_refdef.stats.bloom_drawpixels += r_view.width * r_view.height;
        }
        else if (r_bloomstate.enabled)
@@ -2024,40 +2024,40 @@ static void R_BlendView(void)
                // put the original screen image back in place and blend the bloom
                // texture on it
                R_ResetViewRendering2D();
-               R_Mesh_VertexPointer(r_screenvertex3f);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                GL_Color(1, 1, 1, 1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                // do both in one pass if possible
                R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
-               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f);
+               R_Mesh_TexCoordPointer(0, 2, r_bloomstate.bloomtexcoord2f, 0, 0);
                if (r_textureunits.integer >= 2 && gl_combine.integer)
                {
                        R_Mesh_TexCombine(1, GL_ADD, GL_ADD, 1, 1);
                        R_Mesh_TexBind(1, R_GetTexture(r_bloomstate.texture_screen));
-                       R_Mesh_TexCoordPointer(1, 2, r_bloomstate.screentexcoord2f);
+                       R_Mesh_TexCoordPointer(1, 2, r_bloomstate.screentexcoord2f, 0, 0);
                }
                else
                {
-                       R_Mesh_Draw(0, 4, 2, polygonelements);
+                       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                        r_refdef.stats.bloom_drawpixels += r_view.width * r_view.height;
                        // now blend on the bloom texture
                        GL_BlendFunc(GL_ONE, GL_ONE);
                        R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_screen));
-                       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f);
+                       R_Mesh_TexCoordPointer(0, 2, r_bloomstate.screentexcoord2f, 0, 0);
                }
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
                r_refdef.stats.bloom_drawpixels += r_view.width * r_view.height;
        }
        if (r_refdef.viewblend[3] >= (1.0f / 256.0f))
        {
                // apply a color tint to the whole view
                R_ResetViewRendering2D();
-               R_Mesh_VertexPointer(r_screenvertex3f);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_VertexPointer(r_screenvertex3f, 0, 0);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
        }
 }
 
@@ -2343,10 +2343,10 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
                        c[2] = c[2] * f1 + r_refdef.fogcolor[2] * f2;
                }
        }
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(color);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(color, 0, 0);
        R_Mesh_ResetTextureState();
-       R_Mesh_Draw(8, 12);
+       R_Mesh_Draw(8, 12, 0, 0);
 }
 */
 
@@ -2408,12 +2408,12 @@ void R_DrawNoModel_TransparentCallback(const entity_render_t *ent, const rtlight
        }
        GL_DepthTest(!(ent->effects & EF_NODEPTHTEST));
        GL_CullFace((ent->effects & EF_DOUBLESIDED) ? GL_NONE : GL_FRONT); // quake is backwards, this culls back faces
-       R_Mesh_VertexPointer(nomodelvertex3f);
+       R_Mesh_VertexPointer(nomodelvertex3f, 0, 0);
        if (r_refdef.fogenabled)
        {
                vec3_t org;
                memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
-               R_Mesh_ColorPointer(color4f);
+               R_Mesh_ColorPointer(color4f, 0, 0);
                Matrix4x4_OriginFromMatrix(&ent->matrix, org);
                f2 = VERTEXFOGTABLE(VectorDistance(org, r_view.origin));
                f1 = 1 - f2;
@@ -2428,14 +2428,14 @@ void R_DrawNoModel_TransparentCallback(const entity_render_t *ent, const rtlight
        else if (ent->alpha != 1)
        {
                memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
-               R_Mesh_ColorPointer(color4f);
+               R_Mesh_ColorPointer(color4f, 0, 0);
                for (i = 0, c = color4f;i < 6;i++, c += 4)
                        c[3] *= ent->alpha;
        }
        else
-               R_Mesh_ColorPointer(nomodelcolor4f);
+               R_Mesh_ColorPointer(nomodelcolor4f, 0, 0);
        R_Mesh_ResetTextureState();
-       R_Mesh_Draw(0, 6, 8, nomodelelements);
+       R_Mesh_Draw(0, 6, 8, nomodelelements, 0, 0);
 }
 
 void R_DrawNoModel(entity_render_t *ent)
@@ -2507,21 +2507,21 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_
        vertex3f[10] = origin[1] + left[1] * scalex1 + up[1] * scaley1;
        vertex3f[11] = origin[2] + left[2] * scalex1 + up[2] * scaley1;
 
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        R_Mesh_TexBind(0, R_GetTexture(texture));
-       R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, spritetexcoord2f, 0, 0);
        // FIXME: fixed function path can't properly handle r_view.colorscale > 1
        GL_Color(cr * ifog * r_view.colorscale, cg * ifog * r_view.colorscale, cb * ifog * r_view.colorscale, ca);
-       R_Mesh_Draw(0, 4, 2, polygonelements);
+       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
 
        if (blendfunc2 == GL_ONE_MINUS_SRC_ALPHA)
        {
                R_Mesh_TexBind(0, R_GetTexture(fogtexture));
                GL_BlendFunc(blendfunc1, GL_ONE);
                GL_Color(r_refdef.fogcolor[0] * fog * r_view.colorscale, r_refdef.fogcolor[1] * fog * r_view.colorscale, r_refdef.fogcolor[2] * fog * r_view.colorscale, ca);
-               R_Mesh_Draw(0, 4, 2, polygonelements);
+               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
        }
 }
 
@@ -2626,11 +2626,11 @@ void R_Mesh_AddBrushMeshFromPlanes(rmesh_t *mesh, int numplanes, mplane_t *plane
 static void R_DrawCollisionBrush(const colbrushf_t *brush)
 {
        int i;
-       R_Mesh_VertexPointer(brush->points->v);
+       R_Mesh_VertexPointer(brush->points->v, 0, 0);
        i = (int)(((size_t)brush) / sizeof(colbrushf_t));
        GL_Color((i & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 5) & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 10) & 31) * (1.0f / 32.0f) * r_view.colorscale, 0.2f);
        GL_LockArrays(0, brush->numpoints);
-       R_Mesh_Draw(0, brush->numpoints, brush->numtriangles, brush->elements);
+       R_Mesh_Draw(0, brush->numpoints, brush->numtriangles, brush->elements, 0, 0);
        GL_LockArrays(0, 0);
 }
 
@@ -2639,11 +2639,11 @@ static void R_DrawCollisionSurface(const entity_render_t *ent, const msurface_t
        int i;
        if (!surface->num_collisiontriangles)
                return;
-       R_Mesh_VertexPointer(surface->data_collisionvertex3f);
+       R_Mesh_VertexPointer(surface->data_collisionvertex3f, 0, 0);
        i = (int)(((size_t)surface) / sizeof(msurface_t));
        GL_Color((i & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 5) & 31) * (1.0f / 32.0f) * r_view.colorscale, ((i >> 10) & 31) * (1.0f / 32.0f) * r_view.colorscale, 0.2f);
        GL_LockArrays(0, surface->num_collisionvertices);
-       R_Mesh_Draw(0, surface->num_collisionvertices, surface->num_collisiontriangles, surface->data_collisionelement3i);
+       R_Mesh_Draw(0, surface->num_collisionvertices, surface->num_collisiontriangles, surface->data_collisionelement3i, 0, 0);
        GL_LockArrays(0, 0);
 }
 
@@ -3056,7 +3056,7 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                rsurface_tvector3f = rsurface_modeltvector3f;
                rsurface_normal3f = rsurface_modelnormal3f;
        }
-       R_Mesh_VertexPointer(rsurface_vertex3f);
+       R_Mesh_VertexPointer(rsurface_vertex3f, 0, 0);
 }
 
 void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacelist)
@@ -3072,7 +3072,7 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
        if (texturenumsurfaces == 1)
        {
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
        }
        else if (r_batchmode.integer == 2)
        {
@@ -3085,7 +3085,7 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
                        j = i + 1;
                        if (surface->num_triangles > MAXBATCHTRIANGLES)
                        {
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                                continue;
                        }
                        memcpy(batchelements, rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle, surface->num_triangles * sizeof(int[3]));
@@ -3104,7 +3104,7 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
                        }
                        surface2 = texturesurfacelist[j-1];
                        numvertices = endvertex - firstvertex;
-                       R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements);
+                       R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements, 0, 0);
                }
        }
        else if (r_batchmode.integer == 1)
@@ -3119,7 +3119,7 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
                        numvertices = surface2->num_firstvertex + surface2->num_vertices - surface->num_firstvertex;
                        numtriangles = surface2->num_firsttriangle + surface2->num_triangles - surface->num_firsttriangle;
                        GL_LockArrays(surface->num_firstvertex, numvertices);
-                       R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                       R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                }
        }
        else
@@ -3128,7 +3128,7 @@ void RSurf_DrawBatch_Simple(int texturenumsurfaces, msurface_t **texturesurfacel
                {
                        surface = texturesurfacelist[i];
                        GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                }
        }
 }
@@ -3150,7 +3150,7 @@ static void RSurf_DrawBatch_WithLightmapSwitching(int texturenumsurfaces, msurfa
                if (deluxemaptexunit >= 0)
                        R_Mesh_TexBind(deluxemaptexunit, R_GetTexture(surface->deluxemaptexture));
                GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
        }
        else if (r_batchmode.integer == 2)
        {
@@ -3166,7 +3166,7 @@ static void RSurf_DrawBatch_WithLightmapSwitching(int texturenumsurfaces, msurfa
                        j = i + 1;
                        if (surface->num_triangles > MAXBATCHTRIANGLES)
                        {
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                                continue;
                        }
                        memcpy(batchelements, rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle, surface->num_triangles * sizeof(int[3]));
@@ -3185,7 +3185,7 @@ static void RSurf_DrawBatch_WithLightmapSwitching(int texturenumsurfaces, msurfa
                        }
                        surface2 = texturesurfacelist[j-1];
                        numvertices = endvertex - firstvertex;
-                       R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements);
+                       R_Mesh_Draw(firstvertex, numvertices, batchtriangles, batchelements, 0, 0);
                }
        }
        else if (r_batchmode.integer == 1)
@@ -3219,7 +3219,7 @@ static void RSurf_DrawBatch_WithLightmapSwitching(int texturenumsurfaces, msurfa
                        numvertices = surface2->num_firstvertex + surface2->num_vertices - surface->num_firstvertex;
                        numtriangles = surface2->num_firsttriangle + surface2->num_triangles - surface->num_firsttriangle;
                        GL_LockArrays(surface->num_firstvertex, numvertices);
-                       R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                       R_Mesh_Draw(surface->num_firstvertex, numvertices, numtriangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                }
 #if 0
                Con_Printf("\n");
@@ -3234,7 +3234,7 @@ static void RSurf_DrawBatch_WithLightmapSwitching(int texturenumsurfaces, msurfa
                        if (deluxemaptexunit >= 0)
                                R_Mesh_TexBind(deluxemaptexunit, R_GetTexture(surface->deluxemaptexture));
                        GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                }
        }
 }
@@ -3252,7 +3252,7 @@ static void RSurf_DrawBatch_ShowSurfaces(int texturenumsurfaces, msurface_t **te
                        {
                                float f = ((j + surface->num_firsttriangle) & 31) * (1.0f / 31.0f) * r_view.colorscale;
                                GL_Color(f, f, f, 1);
-                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, 1, (rsurface_model->surfmesh.data_element3i + 3 * (j + surface->num_firsttriangle)));
+                               R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, 1, (rsurface_model->surfmesh.data_element3i + 3 * (j + surface->num_firsttriangle)), 0, 0);
                        }
                }
        }
@@ -3264,7 +3264,7 @@ static void RSurf_DrawBatch_ShowSurfaces(int texturenumsurfaces, msurface_t **te
                        int k = (int)(((size_t)surface) / sizeof(msurface_t));
                        GL_Color((k & 15) * (1.0f / 16.0f) * r_view.colorscale, ((k >> 4) & 15) * (1.0f / 16.0f) * r_view.colorscale, ((k >> 8) & 15) * (1.0f / 16.0f) * r_view.colorscale, 1);
                        GL_LockArrays(surface->num_firstvertex, surface->num_vertices);
-                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle));
+                       R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, (rsurface_model->surfmesh.data_element3i + 3 * surface->num_firsttriangle), 0, 0);
                }
        }
 }
@@ -3336,7 +3336,7 @@ static void RSurf_DrawBatch_GL11_Lightmap(int texturenumsurfaces, msurface_t **t
        rsurface_lightmapcolor4f = NULL;
        if (applyfog)   RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
        if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
-       R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+       R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
        GL_Color(r, g, b, a);
        RSurf_DrawBatch_WithLightmapSwitching(texturenumsurfaces, texturesurfacelist, 0, -1);
 }
@@ -3348,7 +3348,7 @@ static void RSurf_DrawBatch_GL11_Unlit(int texturenumsurfaces, msurface_t **text
        rsurface_lightmapcolor4f = NULL;
        if (applyfog)   RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
        if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
-       R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+       R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
        GL_Color(r, g, b, a);
        RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
 }
@@ -3403,7 +3403,7 @@ static void RSurf_DrawBatch_GL11_VertexColor(int texturenumsurfaces, msurface_t
                rsurface_lightmapcolor4f = rsurface_model->surfmesh.data_lightmapcolor4f;
        if (applyfog)   RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
        if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
-       R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+       R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
        GL_Color(r, g, b, a);
        RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
 }
@@ -3462,7 +3462,7 @@ static void RSurf_DrawBatch_GL11_VertexShade(int texturenumsurfaces, msurface_t
        }
        if (applyfog)   RSurf_DrawBatch_GL11_ApplyFog(texturenumsurfaces, texturesurfacelist);
        if (applycolor) RSurf_DrawBatch_GL11_ApplyColor(texturenumsurfaces, texturesurfacelist, r, g, b, a);
-       R_Mesh_ColorPointer(rsurface_lightmapcolor4f);
+       R_Mesh_ColorPointer(rsurface_lightmapcolor4f, 0, 0);
        GL_Color(r, g, b, a);
        RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
 }
@@ -3476,7 +3476,7 @@ static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, msurfa
                rsurface_mode = RSURFMODE_SHOWSURFACES;
                GL_DepthMask(true);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                R_Mesh_ResetTextureState();
        }
        RSurf_PrepareVerticesForBatch(false, false, texturenumsurfaces, texturesurfacelist);
@@ -3515,7 +3515,7 @@ static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, msurface_t **te
        if (rsurface_model->type == mod_brushq1 && r_q1bsp_skymasking.integer && !r_viewcache.world_novis)
        {
                GL_Color(r_refdef.fogcolor[0] * r_view.colorscale, r_refdef.fogcolor[1] * r_view.colorscale, r_refdef.fogcolor[2] * r_view.colorscale, 1);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                R_Mesh_ResetTextureState();
                if (skyrendermasked)
                {
@@ -3553,32 +3553,32 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, msurface_t **t
                RSurf_PrepareVerticesForBatch(true, r_glsl_permutation->loc_Texture_Normal, texturenumsurfaces, texturesurfacelist);
        else
                RSurf_PrepareVerticesForBatch(r_glsl_permutation->loc_Texture_Normal, r_glsl_permutation->loc_Texture_Normal, texturenumsurfaces, texturesurfacelist);
-       R_Mesh_TexCoordPointer(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f);
-       R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
-       R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
-       R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
-       R_Mesh_TexCoordPointer(4, 2, rsurface_model->surfmesh.data_texcoordlightmap2f);
+       R_Mesh_TexCoordPointer(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f, 0, 0);
+       R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f, 0, 0);
+       R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f, 0, 0);
+       R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f, 0, 0);
+       R_Mesh_TexCoordPointer(4, 2, rsurface_model->surfmesh.data_texcoordlightmap2f, 0, 0);
 
        if (rsurface_texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT)
        {
                R_Mesh_TexBind(7, R_GetTexture(r_texture_white));
                if (r_glsl_permutation->loc_Texture_Deluxemap >= 0)
                        R_Mesh_TexBind(8, R_GetTexture(r_texture_blanknormalmap));
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
        }
        else if (rsurface_uselightmaptexture)
        {
                R_Mesh_TexBind(7, R_GetTexture(texturesurfacelist[0]->lightmaptexture));
                if (r_glsl_permutation->loc_Texture_Deluxemap >= 0)
                        R_Mesh_TexBind(8, R_GetTexture(texturesurfacelist[0]->deluxemaptexture));
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
        }
        else
        {
                R_Mesh_TexBind(7, R_GetTexture(r_texture_white));
                if (r_glsl_permutation->loc_Texture_Deluxemap >= 0)
                        R_Mesh_TexBind(8, R_GetTexture(r_texture_blanknormalmap));
-               R_Mesh_ColorPointer(rsurface_model->surfmesh.data_lightmapcolor4f);
+               R_Mesh_ColorPointer(rsurface_model->surfmesh.data_lightmapcolor4f, 0, 0);
        }
 
        if (rsurface_uselightmaptexture && !(rsurface_texture->currentmaterialflags & MATERIALFLAG_FULLBRIGHT))
@@ -3635,7 +3635,7 @@ static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **t
                }
                layercolor[3] = layer->color[3];
                applycolor = layercolor[0] != 1 || layercolor[1] != 1 || layercolor[2] != 1 || layercolor[3] != 1;
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                applyfog = (layer->flags & TEXTURELAYERFLAG_FOGDARKEN) != 0;
                switch (layer->type)
                {
@@ -3675,7 +3675,7 @@ static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **t
                        }
                        R_Mesh_TextureState(&m);
                        // generate a color array for the fog pass
-                       R_Mesh_ColorPointer(rsurface_array_color4f);
+                       R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
                        for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
                        {
                                int i;
@@ -3730,7 +3730,7 @@ static void R_DrawTextureSurfaceList_GL11(int texturenumsurfaces, msurface_t **t
                }
                GL_DepthMask(layer->depthmask);
                GL_BlendFunc(layer->blendfunc1, layer->blendfunc2);
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                applyfog = (layer->flags & TEXTURELAYERFLAG_FOGDARKEN) != 0;
                switch (layer->type)
                {
@@ -3784,7 +3784,7 @@ static void R_DrawTextureSurfaceList_GL11(int texturenumsurfaces, msurface_t **t
                        break;
                case TEXTURELAYERTYPE_FOG:
                        // singletexture fogging
-                       R_Mesh_ColorPointer(rsurface_array_color4f);
+                       R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
                        if (layer->texture)
                        {
                                memset(&m, 0, sizeof(m));
@@ -3978,8 +3978,8 @@ void R_DrawLoc_Callback(const entity_render_t *ent, const rtlight_t *rtlight, in
        GL_CullFace(GL_NONE);
        R_Mesh_Matrix(&identitymatrix);
 
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
 
        i = surfacelist[0];
@@ -4003,7 +4003,7 @@ void R_DrawLoc_Callback(const entity_render_t *ent, const rtlight_t *rtlight, in
                for (j = 0;j < 3;j++, i++)
                        vertex3f[i] = mins[j] + size[j] * locboxvertex3f[i];
 
-       R_Mesh_Draw(0, 6*4, 6*2, locboxelement3i);
+       R_Mesh_Draw(0, 6*4, 6*2, locboxelement3i, 0, 0);
 }
 
 void R_DrawLocs(void)
@@ -4028,7 +4028,7 @@ void R_DrawCollisionBrushes(entity_render_t *ent)
        if (!model->brush.num_brushes)
                return;
        CHECKGLERROR
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
@@ -4054,7 +4054,7 @@ void R_DrawTrianglesAndNormals(entity_render_t *ent, qboolean drawtris, qboolean
        GL_DepthTest(!r_showdisabledepthtest.integer);
        GL_DepthMask(true);
        GL_BlendFunc(GL_ONE, GL_ZERO);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
        {
index b507c46a8542d53cac67137855655512e2885f7c..d25f3513ac96453991caa90be412352e43672ea2 100644 (file)
@@ -343,8 +343,8 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *r
 
        numpoints = min(portal->numpoints, POLYGONELEMENTS_MAXPOINTS);
 
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
 
        i = surfacelist[0];
@@ -354,7 +354,7 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *r
                         0.125f);
        for (i = 0, v = vertex3f;i < numpoints;i++, v += 3)
                VectorCopy(portal->points[i].position, v);
-       R_Mesh_Draw(0, numpoints, numpoints - 2, polygonelements);
+       R_Mesh_Draw(0, numpoints, numpoints - 2, polygonelements, 0, 0);
 }
 
 // LordHavoc: this is just a nice debugging tool, very slow
index 0c343154e66a809be0b484f5d4e2865235bc6177..3d8efefbf5c4452d0ebe6e5e47c0e986bcd6599e 100644 (file)
@@ -191,7 +191,7 @@ static void R_DrawExplosion_TransparentCallback(const entity_render_t *ent, cons
        GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
        R_Mesh_Matrix(&identitymatrix);
 
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        memset(&m, 0, sizeof(m));
        m.tex[0] = R_GetTexture(explosiontexture);
        m.pointer_texcoord[0] = explosiontexcoord2f[0];
@@ -199,11 +199,11 @@ static void R_DrawExplosion_TransparentCallback(const entity_render_t *ent, cons
        for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
        {
                const explosion_t *e = explosion + surfacelist[surfacelistindex];
-               R_Mesh_VertexPointer(e->vert[0]);
+               R_Mesh_VertexPointer(e->vert[0], 0, 0);
                // FIXME: fixed function path can't properly handle r_view.colorscale > 1
                GL_Color(e->alpha * r_view.colorscale, e->alpha * r_view.colorscale, e->alpha * r_view.colorscale, 1);
                GL_LockArrays(0, numverts);
-               R_Mesh_Draw(0, numverts, numtriangles, explosiontris[0]);
+               R_Mesh_Draw(0, numverts, numtriangles, explosiontris[0], 0, 0);
                GL_LockArrays(0, 0);
        }
 }
index 9fb871e11f2e31b28d5ef893fd3827b8d5062a5d..0d287946dd794dee0e62e691cdda64afc92f6f3b 100644 (file)
@@ -245,18 +245,18 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, const r
        if (!r_lightningbeam_qmbtexture.integer && r_lightningbeamtexture == NULL)
                r_lightningbeams_setuptexture();
 
-       R_Mesh_VertexPointer(vertex3f);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
        // FIXME: fixed function path can't properly handle r_view.colorscale > 1
        if (r_refdef.fogenabled)
        {
                // per vertex colors if fog is used
-               R_Mesh_ColorPointer(color4f);
+               R_Mesh_ColorPointer(color4f, 0, 0);
                R_FogLightningBeam_Vertex3f_Color4f(vertex3f, color4f, 12, r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
        }
        else
        {
                // solid color if fog is not used
-               R_Mesh_ColorPointer(NULL);
+               R_Mesh_ColorPointer(NULL, 0, 0);
                GL_Color(r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
        }
        memset(&m, 0, sizeof(m));
@@ -336,7 +336,7 @@ void R_DrawLightningBeam_TransparentCallback(const entity_render_t *ent, const r
 
                // draw the 3 polygons as one batch of 6 triangles using the 12 vertices
                GL_LockArrays(0, 12);
-               R_Mesh_Draw(0, 12, 6, r_lightningbeamelements);
+               R_Mesh_Draw(0, 12, 6, r_lightningbeamelements, 0, 0);
                GL_LockArrays(0, 0);
        }
 }
index 76abca57c1c62423fa4827c3e693bcfe0328e3e9..77026205ea4e2fff80838120bba005f97cd6f681 100644 (file)
@@ -900,19 +900,19 @@ void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *verte
        }
        r_refdef.stats.lights_shadowtriangles += numtriangles;
        CHECKGLERROR
-       R_Mesh_VertexPointer(vertex3f);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
        GL_LockArrays(0, numvertices);
        if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
        {
                // decrement stencil if backface is behind depthbuffer
                GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
                qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
-               R_Mesh_Draw(0, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
                // increment stencil if frontface is behind depthbuffer
                GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
                qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
        }
-       R_Mesh_Draw(0, numvertices, numtriangles, element3i);
+       R_Mesh_Draw(0, numvertices, numtriangles, element3i, 0, 0);
        GL_LockArrays(0, 0);
        CHECKGLERROR
 }
@@ -1003,7 +1003,7 @@ void R_Shadow_RenderMode_Begin(void)
                R_Shadow_MakeTextures();
 
        CHECKGLERROR
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthTest(true);
@@ -1044,7 +1044,7 @@ void R_Shadow_RenderMode_Reset(void)
        {
                qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);CHECKGLERROR
        }
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        GL_DepthTest(true);
        GL_DepthMask(false);
@@ -1468,24 +1468,24 @@ static void R_Shadow_RenderLighting_VisibleLighting(int firstvertex, int numvert
 {
        // used to display how many times a surface is lit for level design purposes
        GL_Color(0.1 * r_view.colorscale, 0.025 * r_view.colorscale, 0, 1);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
-       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 }
 
 static void R_Shadow_RenderLighting_Light_GLSL(int firstvertex, int numvertices, int numtriangles, const int *element3i, const vec3_t lightcolorbase, const vec3_t lightcolorpants, const vec3_t lightcolorshirt, rtexture_t *basetexture, rtexture_t *pantstexture, rtexture_t *shirttexture, rtexture_t *normalmaptexture, rtexture_t *glosstexture, float ambientscale, float diffusescale, float specularscale, qboolean dopants, qboolean doshirt)
 {
        // ARB2 GLSL shader path (GFFX5200, Radeon 9500)
        R_SetupSurfaceShader(lightcolorbase, false, ambientscale, diffusescale, specularscale);
-       R_Mesh_TexCoordPointer(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f);
-       R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
-       R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
-       R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f);
+       R_Mesh_TexCoordPointer(0, 2, rsurface_model->surfmesh.data_texcoordtexture2f, 0, 0);
+       R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f, 0, 0);
+       R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f, 0, 0);
+       R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f, 0, 0);
        if (rsurface_texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
        {
                qglDepthFunc(GL_EQUAL);CHECKGLERROR
        }
-       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
        if (rsurface_texture->currentmaterialflags & MATERIALFLAG_ALPHATEST)
        {
                qglDepthFunc(GL_LEQUAL);CHECKGLERROR
@@ -1500,7 +1500,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_Finalize(int firstvertex, int num
        for (renders = 0;renders < 64 && (r > 0 || g > 0 || b > 0);renders++, r--, g--, b--)
        {
                GL_Color(bound(0, r, 1), bound(0, g, 1), bound(0, b, 1), 1);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
        }
 }
 
@@ -1591,7 +1591,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_AmbientPass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1641,7 +1641,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1666,7 +1666,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1679,7 +1679,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
                R_Mesh_TextureState(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1708,7 +1708,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1740,7 +1740,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1768,7 +1768,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                R_Mesh_TextureState(&m);
                GL_ColorMask(0,0,0,1);
                GL_BlendFunc(GL_ONE, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1781,7 +1781,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_DiffusePass(int firstvertex, int
                m.pointer_texcoord3f[1] = rsurface_array_texcoord3f;
                R_Mesh_TextureState(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second pass
                memset(&m, 0, sizeof(m));
@@ -1825,14 +1825,14 @@ static void R_Shadow_RenderLighting_Light_Dot3_SpecularPass(int firstvertex, int
                GL_ColorMask(0,0,0,1);
                // this squares the result
                GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second and third pass
                R_Mesh_ResetTextureState();
                // square alpha in framebuffer a few times to make it shiny
                GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
-                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // fourth pass
                memset(&m, 0, sizeof(m));
@@ -1841,7 +1841,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_SpecularPass(int firstvertex, int
                m.texmatrix[0] = r_shadow_entitytoattenuationxyz;
                R_Mesh_TextureState(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // fifth pass
                memset(&m, 0, sizeof(m));
@@ -1870,14 +1870,14 @@ static void R_Shadow_RenderLighting_Light_Dot3_SpecularPass(int firstvertex, int
                GL_ColorMask(0,0,0,1);
                // this squares the result
                GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second and third pass
                R_Mesh_ResetTextureState();
                // square alpha in framebuffer a few times to make it shiny
                GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
-                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // fourth pass
                memset(&m, 0, sizeof(m));
@@ -1903,14 +1903,14 @@ static void R_Shadow_RenderLighting_Light_Dot3_SpecularPass(int firstvertex, int
                GL_ColorMask(0,0,0,1);
                // this squares the result
                GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // second and third pass
                R_Mesh_ResetTextureState();
                // square alpha in framebuffer a few times to make it shiny
                GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
                for (glossexponent = 2;glossexponent * 2 <= r_shadow_glossexponent.value;glossexponent *= 2)
-                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+                       R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // fourth pass
                memset(&m, 0, sizeof(m));
@@ -1922,7 +1922,7 @@ static void R_Shadow_RenderLighting_Light_Dot3_SpecularPass(int firstvertex, int
                m.texmatrix[1] = r_shadow_entitytoattenuationz;
                R_Mesh_TextureState(&m);
                GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
-               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i);
+               R_Mesh_Draw(firstvertex, numvertices, numtriangles, element3i, 0, 0);
 
                // fifth pass
                memset(&m, 0, sizeof(m));
@@ -1950,7 +1950,7 @@ static void R_Shadow_RenderLighting_Light_Dot3(int firstvertex, int numvertices,
        qboolean dospecular = specularscale > 0;
        if (!doambient && !dodiffuse && !dospecular)
                return;
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        if (doambient)
                R_Shadow_RenderLighting_Light_Dot3_AmbientPass(firstvertex, numvertices, numtriangles, element3i, lightcolorbase, basetexture, ambientscale * r_view.colorscale);
        if (dodiffuse)
@@ -2023,7 +2023,7 @@ void R_Shadow_RenderLighting_Light_Vertex_Pass(const model_t *model, int firstve
                                newe += 3;
                                if (newnumtriangles >= 1024)
                                {
-                                       R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements);
+                                       R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements, 0, 0);
                                        newnumtriangles = 0;
                                        newe = newelements;
                                        stop = false;
@@ -2032,7 +2032,7 @@ void R_Shadow_RenderLighting_Light_Vertex_Pass(const model_t *model, int firstve
                }
                if (newnumtriangles >= 1)
                {
-                       R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements);
+                       R_Mesh_Draw(newfirstvertex, newlastvertex - newfirstvertex + 1, newnumtriangles, newelements, 0, 0);
                        stop = false;
                }
                // if we couldn't find any lit triangles, exit early
@@ -2076,7 +2076,7 @@ static void R_Shadow_RenderLighting_Light_Vertex(int firstvertex, int numvertice
        VectorScale(lightcolorshirt, ambientscale * 2 * r_view.colorscale, ambientcolorshirt);
        VectorScale(lightcolorshirt, diffusescale * 2 * r_view.colorscale, diffusecolorshirt);
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
-       R_Mesh_ColorPointer(rsurface_array_color4f);
+       R_Mesh_ColorPointer(rsurface_array_color4f, 0, 0);
        memset(&m, 0, sizeof(m));
        m.tex[0] = R_GetTexture(basetexture);
        m.texmatrix[0] = rsurface_texture->currenttexmatrix;
@@ -2526,19 +2526,19 @@ void R_Shadow_DrawWorldShadow(int numsurfaces, int *surfacelist, const unsigned
                for (mesh = r_shadow_rtlight->static_meshchain_shadow;mesh;mesh = mesh->next)
                {
                        r_refdef.stats.lights_shadowtriangles += mesh->numtriangles;
-                       R_Mesh_VertexPointer(mesh->vertex3f);
+                       R_Mesh_VertexPointer(mesh->vertex3f, 0, 0);
                        GL_LockArrays(0, mesh->numverts);
                        if (r_shadow_rendermode == R_SHADOW_RENDERMODE_STENCIL)
                        {
                                // decrement stencil if backface is behind depthbuffer
                                GL_CullFace(GL_BACK); // quake is backwards, this culls front faces
                                qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
-                               R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i);
+                               R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, 0, 0);
                                // increment stencil if frontface is behind depthbuffer
                                GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
                                qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP);CHECKGLERROR
                        }
-                       R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i);
+                       R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i, 0, 0);
                        GL_LockArrays(0, 0);
                }
                CHECKGLERROR
@@ -2924,8 +2924,8 @@ void R_DrawModelShadows(void)
        GL_ScissorTest(true);
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
-       R_Mesh_VertexPointer(vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
 
        // set up a 50% darkening blend on shadowed areas
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -2941,7 +2941,7 @@ void R_DrawModelShadows(void)
        qglStencilFunc(GL_NOTEQUAL, 128, ~0);CHECKGLERROR
 
        // apply the blend to the shadowed areas
-       R_Mesh_Draw(0, 4, 2, polygonelements);
+       R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
 
        // restoring the perspective view is done by R_RenderScene
        //R_SetupView(&r_view.matrix);
diff --git a/r_sky.c b/r_sky.c
index 401562b8bfaa06d02070a23239ec0c91f38bea88..837dde9f540d30fc2896510f6753fe660cf0d868 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -273,15 +273,15 @@ static void R_SkyBox(void)
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(false);
        GL_DepthTest(false); // don't modify or read zbuffer
-       R_Mesh_VertexPointer(skyboxvertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(skyboxvertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
-       R_Mesh_TexCoordPointer(0, 2, skyboxtexcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, skyboxtexcoord2f, 0, 0);
        GL_LockArrays(0, 6*4);
        for (i = 0;i < 6;i++)
        {
                R_Mesh_TexBind(0, R_GetTexture(skyboxside[i]));
-               R_Mesh_Draw(0, 6*4, 2, skyboxelements + i * 6);
+               R_Mesh_Draw(0, 6*4, 2, skyboxelements + i * 6, 0, 0);
        }
        GL_LockArrays(0, 0);
 }
@@ -371,34 +371,34 @@ static void R_SkySphere(void)
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
        GL_DepthTest(false); // don't modify or read zbuffer
-       R_Mesh_VertexPointer(skysphere_vertex3f);
-       R_Mesh_ColorPointer(NULL);
+       R_Mesh_VertexPointer(skysphere_vertex3f, 0, 0);
+       R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
        R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.solidskytexture));
-       R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f);
+       R_Mesh_TexCoordPointer(0, 2, skysphere_texcoord2f, 0, 0);
        R_Mesh_TexMatrix(0, &scroll1matrix);
        if (r_textureunits.integer >= 2 && r_view.colorscale == 1)
        {
                // one pass using GL_DECAL or GL_INTERPOLATE_ARB for alpha layer
                R_Mesh_TexBind(1, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));
                R_Mesh_TexCombine(1, gl_combine.integer ? GL_INTERPOLATE_ARB : GL_DECAL, GL_MODULATE, 1, 1);
-               R_Mesh_TexCoordPointer(1, 2, skysphere_texcoord2f);
+               R_Mesh_TexCoordPointer(1, 2, skysphere_texcoord2f, 0, 0);
                R_Mesh_TexMatrix(1, &scroll2matrix);
                GL_LockArrays(0, skysphere_numverts);
-               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
                GL_LockArrays(0, 0);
        }
        else
        {
                // two pass
                GL_LockArrays(0, skysphere_numverts);
-               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
 
                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                R_Mesh_TexBind(0, R_GetTexture(r_refdef.worldmodel->brush.alphaskytexture));
                R_Mesh_TexMatrix(0, &scroll2matrix);
                GL_LockArrays(0, skysphere_numverts);
-               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i);
+               R_Mesh_Draw(0, skysphere_numverts, skysphere_numtriangles, skysphere_element3i, 0, 0);
                GL_LockArrays(0, 0);
        }
 }