Don't allow zero as a valid texture ID

This commit is contained in:
Luke Benstead 2019-02-28 18:28:43 +00:00
parent 6189f8d671
commit 31ed419dfa

View File

@ -240,6 +240,7 @@ void APIENTRY glBindTexture(GLenum target, GLuint texture) {
return; return;
} }
if(texture) {
/* If this didn't come from glGenTextures, then we should initialize the /* If this didn't come from glGenTextures, then we should initialize the
* texture the first time it's bound */ * texture the first time it's bound */
if(!named_array_used(&TEXTURE_OBJECTS, texture)) { if(!named_array_used(&TEXTURE_OBJECTS, texture)) {
@ -247,7 +248,6 @@ void APIENTRY glBindTexture(GLenum target, GLuint texture) {
_glInitializeTextureObject(txr, texture); _glInitializeTextureObject(txr, texture);
} }
if(texture) {
TEXTURE_UNITS[ACTIVE_TEXTURE] = (TextureObject*) named_array_get(&TEXTURE_OBJECTS, texture); TEXTURE_UNITS[ACTIVE_TEXTURE] = (TextureObject*) named_array_get(&TEXTURE_OBJECTS, texture);
} else { } else {
TEXTURE_UNITS[ACTIVE_TEXTURE] = NULL; TEXTURE_UNITS[ACTIVE_TEXTURE] = NULL;