i read the nehe tut no. 6 for understanding texture loading…but there is something i dont understood completely
he is loading the texture data in the function
after this he was calling the standardfunctions for creating a texture…but then…he free’s the allocated memory completely
now to my questions…
if ive done the following…
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
what happens to opengl… cause nehe is deleting the image data… so i guess opengl does a copy of the data and assigning it to the texture array value… is the value in the texture array an adress to a memory location???
i only want a detailed explanation what opengl does if i try to generate a texture
hope someone can help
texture is an array of texture names
and many times if texture is filled with
glGenTextures (supposed there are not textures currently loaded) it happens that:
texture[i] == i
it doesn’t matter the values stored in this array any way…
if you want to access your texture #i
just call glBindTexture passing texture[i] as texture name
Then the tutorial deletes the texture data because OpenGL creates a copy of the tex inside the graphic memory or elsewhere if it runs out.
I hope I been of help
When you load a texture, it is in some format like BMP, TGA, etc.
First thing done is the image is read into a temp storage and decoded in a format that openGL can understand.
Once in a format that openGL can read, then we need to tell openGL that it is a texture.
glGenTextures // Set’s up a name in which we can identify then new texture, done internal of opengl
glBindTexture // Tell openGL to use the generated name, with this texture.
glTexImage2D // Load the texture
Now openGL manages the textures ether putting them in the video cards memory or some other memory location, we call the texture by using the name (id) that openGL generated for us.
That is why in the NeHe tutor he deletes the one texture variable; since it is no longer needed and that texture is now in another location managed by openGL.
ahh…thx i wasnt sure if iam able to delete the imagedata…now iam