Archived

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

Hostility

Quick question for the willing

Recommended Posts

In a program I''m writing, I load new textures to the same GLuint texture[] array at various times during execution. Should I be removing old textures in some way, or will this effectively replace the old ones? I want to minimize the amount of textures in memory at one time, so I thought I''d make sure I''m going about it the correct way. Thanks!

Share this post


Link to post
Share on other sites
I am not that familiar with Open GL, but I think you should be clearing and releasing the memory before you move a new texture in. As far as I know if you move a new texture in without clearing the memeory the old textures memory address lost and now you have a 256kb texture in the memory that you cannot access to clear. Your safest bet would be to clear the memory before you put a new texture in, even if I''m wrong it is a good coding practice. Good luck!

Share this post


Link to post
Share on other sites
An array is simply a series of pointers to memory locations grouped together. If you replace the data at a single memory block with new data, the old data will be written over, but, if the old data used more space than the new data, then you will have extra bits at the end of your memory block. Usually this doesn''t hurt, and with standardized data types (int, char, float, etc...) won''t happen, but I''m not sure how the texture storage type works, so it would be a good idea to clear the memory you''ve been using before writing to it again.

Share this post


Link to post
Share on other sites