Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm confused about how to delete a previously applied texture.

So, I've applied my texture and am happily rendering it.

I decide I want to delete the texture, so this is what I've tried......

void deleteTexture(){

    textureToDelete[0]=texID;
    GLES20.glDeleteTextures(1, textureToDelete, 0);

}

So, texID is basically an int value that holds the ID of the texture that is bound to the quad at render time:

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);

I've searched on the internet for an answer to this but it seems a little confusing and I can't find any decent Android / Java specific examples.

This is how I understand it. In the line:

 GLES20.glDeleteTextures(1, textureToDelete, 0);

The first argument (1) is the number of textures I want to delete. Next is textureToDelete. This is an array (of length 1) which is populated in it's one index with the texture ID to delete. Then 0 is the offset.

Have I got this right? After calling my method, the texture is still applied.

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.