Archived

This topic is now archived and is closed to further replies.

Textures and Memory

This topic is 5599 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Right, but remmember to delete the texture if you don''t use it anymore. glDeleteTextures() if i remmember correctly...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites