diff options
-rw-r--r-- | src/library_gl.js | 8 | ||||
-rw-r--r-- | tests/cube_explosion.c | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 0566b3a0..f7966dab 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -424,11 +424,9 @@ var LibraryGL = { }, glIsTexture: function(texture) { - var fb = GL.textures[texture]; - if (typeof(fb) == 'undefined') { - return 0; - } - return Module.ctx.isTexture(fb); + var texture = GL.textures[texture]; + if (!texture) return 0; + return Module.ctx.isTexture(texture); }, glGenBuffers__sig: 'vii', diff --git a/tests/cube_explosion.c b/tests/cube_explosion.c index ee990a57..3f55b3c6 100644 --- a/tests/cube_explosion.c +++ b/tests/cube_explosion.c @@ -64,8 +64,11 @@ int main(int argc, char *argv[]) // Create a texture GLuint texture; + assert(!glIsTexture(1)); // not a texture glGenTextures( 1, &texture ); + assert(!glIsTexture(texture)); // not a texture until glBindTexture glBindTexture( GL_TEXTURE_2D, texture ); + assert(glIsTexture(texture)); // NOW it is a texture glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); GLubyte textureData[16*16*4]; @@ -223,6 +226,10 @@ int main(int argc, char *argv[]) SDL_GL_SwapBuffers(); + assert(glIsTexture(texture)); // still a texture + glDeleteTextures(1, &texture); + assert(!glIsTexture(texture)); // but not anymore + verify(); #if !EMSCRIPTEN |