From: havoc Date: Wed, 29 Mar 2006 13:25:09 +0000 (+0000) Subject: fix a crash in r_showsurfaces X-Git-Tag: xonotic-v0.1.0preview~4114 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=906db963b5ddd7afa7305174993c1f22c182a870;p=xonotic%2Fdarkplaces.git fix a crash in r_showsurfaces git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6215 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index e9ed8aaf..7af8009a 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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));