From 906db963b5ddd7afa7305174993c1f22c182a870 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 29 Mar 2006 13:25:09 +0000 Subject: [PATCH] fix a crash in r_showsurfaces git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6215 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)); -- 2.39.2