texture cleanup

Hello,
If I understand correctly, glGenTextures() creates texture object(s), while glDeleteTextures() removes them. When I call glBindTexture() I specify the texture object to be used, and when I call glTexImage2D() texture data is provided for the currently specified texture object. I’d like to find out what happens if I call glTexImage2D() twice on the same texture object. Is OpenGL implementation going to release the current texture data and replace it with the new data ? I’m assuming this is the case, I just wanted to make sure - I haven’t seen any function that would release the texture data only (not the texture object itself).
I’d appreciate if someone could verify this.
Thank you,

Martin

Yes, the previous data will be forgotten about.

Note that glTexImage2D() (and TexSubImage2D(), and the 1D, 3D, cube, etc versions) are copying. Once the call returns, it’s your responsibility to free the bits pointer you passed in; the GL has copied the entire image at that point, and will manage that image copy as it sees fit.