]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix a crash in r_showsurfaces
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 29 Mar 2006 13:25:09 +0000 (13:25 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 29 Mar 2006 13:25:09 +0000 (13:25 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6215 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index e9ed8aafa0c7072ae63f20a6406d075d9a7e7b5e..7af8009a7a92ed0ca88da60dcf767b79d5873ef8 100644 (file)
@@ -3315,12 +3315,18 @@ void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces)
                GL_BlendFunc(GL_ONE, GL_ZERO);
                memset(&m, 0, sizeof(m));
                R_Mesh_State(&m);
-               RSurf_SetPointersForPass(false, false);
+               t = NULL;
                for (i = 0, j = model->firstmodelsurface, surface = model->data_surfaces + j;i < model->nummodelsurfaces;i++, j++, surface++)
                {
                        if (ent == r_refdef.worldentity && !r_worldsurfacevisible[j])
                                continue;
-                       texture = surface->texture->currentframe;
+                       if (t != surface->texture)
+                       {
+                               t = surface->texture;
+                               texture = t->currentframe;
+                               RSurf_PrepareForBatch(ent, texture, modelorg);
+                               RSurf_SetPointersForPass(false, false);
+                       }
                        if ((texture->currentmaterialflags & flagsmask) && surface->num_triangles)
                        {
                                int k = (int)(((size_t)surface) / sizeof(msurface_t));