Textures and Memory

Started by
3 comments, last by glnefugio 21 years, 8 months ago
If I have the texture loaded, called the glTexGen glTexParametri and gluBuild2DMipMap functions then I only have to keep the Texture ID or do I have to keep the data read from the file??
Advertisement
Just the ID - the textures are created into your video memory by OpenGL. Take a look at Nehe''s basecode - he always deletes any allocated stuff after creating the texture...

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Right, but remmember to delete the texture if you don''t use it anymore. glDeleteTextures() if i remmember correctly...
quote:Original post by Anonymous Poster
glDeleteTextures() if i remmember correctly...


I''ve never actually understood what the practical use of this is other than writing beautiful code (it''s a lot like delete''ing an object before exiting - if you don''t do it, the OS most likely will - it''s a matter of style and correctness of code, not of neccessity). Your textures should be "freed" when the corresponding HGLRC is destroyed (released), leaving the space taken up by the textures abailable for reuse. Somebody correct me if I''m wrong...

Crispy

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Unless you use the same textures for every level in your game it's a good idea to free unused ones. Hell, you should destroy everything you create. That counts textures, sounds, allocated objects, everything!

Also there are some crappy drivers out there, so don't skimp on the housekeeping.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions


[edited by - siaspete on August 19, 2002 1:14:17 PM]

This topic is closed to new replies.

Advertisement