What I dont understand is how the texture name texturedata[0] is related to the data texture? I was looking at the nehe code for lesson 6 and they delete the data right after binding which really throws me off more, if someone could please explain thanks.
“texturedata[0]” is actually the name (identifier) for your texture, whereas the variable “texture” is the actual texture data.
BindTexture creates a texture object with the name which was returned by GenTextures. TexImage populates the texture object with a texture of the given dimensions and texel data.
after the TexImage call you no longer need “texture” because the GL now has a copy of the texture data, in a texture object identified by texturedata[0].
Those variable names were just from an example. I understand what each one is doing. I know that texturedata holds the name that is generated by glGenTextures and that texture is the image data. What im failing to see is how the name in texturedata[0] is bound to the image data texture, what I think happens is that glBindTexture tells gl which texture im using? and then the call to glTexImage2D stores the image data to the currently selected name?