Disposing of Textures

It is also useful to know how to delete a texture object from video RAM if we no longer need it (like we use Bitmap.recycle() to release the memory of a bitmap). This can be achieved with the following snippet:

gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); int texturelds = { textureid }; gl.glDeleteTextures(1, texturelds, 0);

Note that we first have to make sure that the texture object is not currently bound before we can delete it. The rest is similar to how we used glGenTextures() to create a texture object.

Was this article helpful?

0 0

Post a comment