]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_textures.c
FS_LoadFile: don't segfault when trying to open a non-regular file
[xonotic/darkplaces.git] / gl_textures.c
index 2ef60566c39c1266da980e7c9161b87f10276205..e5d35a9ac4f264221550d8e6f9a48632c1fd57bc 100644 (file)
@@ -226,7 +226,7 @@ void R_MarkDirtyTexture(rtexture_t *rt) {
        if( !glt->dirtytexnum && glt->flags & GLTEXF_DYNAMIC ) {
                glt->dirtytexnum = glt->texnum;
                // mark it as dirty, so R_RealGetTexture gets called
-               glt->texnum = -1;
+               glt->texnum = 0;
        }
 }
 
@@ -308,7 +308,7 @@ void R_FreeTexture(rtexture_t *rt)
        else
                Host_Error("R_FreeTexture: texture \"%s\" not linked in pool", glt->identifier);
 
-       if (glt->texnum)
+       if (!(glt->flags & GLTEXF_UPLOAD))
        {
                CHECKGLERROR
                qglDeleteTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR
@@ -1047,7 +1047,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
        glt->glformat = texinfo->glformat;
        glt->bytesperpixel = texinfo->internalbytesperpixel;
        glt->sides = glt->texturetype == GLTEXTURETYPE_CUBEMAP ? 6 : 1;
-       glt->texnum = -1;
+       glt->texnum = 0;
        // init the dynamic texture attributes, too [11/22/2007 Black]
        glt->dirtytexnum = 0;
        glt->updatecallback = NULL;