From 3af484f86440c5c87cd76c1e4f944c879de00ea1 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Thu, 4 Apr 2013 17:12:20 +1030 Subject: [PATCH] draw: factor out scrap init from Draw_Init Signed-off-by: Kevin Shanahan --- common/gl_draw.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/common/gl_draw.c b/common/gl_draw.c index 4a3e4a6..2ef3df4 100644 --- a/common/gl_draw.c +++ b/common/gl_draw.c @@ -132,6 +132,18 @@ typedef struct { static scrap_t gl_scraps[MAX_SCRAPS]; +static void +Scrap_Init(void) +{ + int i; + scrap_t *scrap; + + memset(gl_scraps, 0, sizeof(gl_scraps)); + scrap = gl_scraps; + for (i = 0; i < MAX_SCRAPS; i++, scrap++) + glGenTextures(1, &scrap->glnum); +} + /* * Scrap_AllocBlock * Returns a scrap and the position inside it @@ -459,7 +471,6 @@ Draw_Init(void) glpic_t *gl; int start; byte *ncdata; - scrap_t *scrap; Cvar_RegisterVariable(&gl_nobind); Cvar_RegisterVariable(&gl_max_size); @@ -535,10 +546,8 @@ Draw_Init(void) // save a texture slot for translated picture glGenTextures(1, &translate_texture); - // save slots for scraps - scrap = gl_scraps; - for (i = 0; i < MAX_SCRAPS; i++, scrap++) - glGenTextures(1, &scrap->glnum); + // create textures for scraps + Scrap_Init(); // // get the other pics we need