Advertisement

Quick question for the willing

Started by August 12, 2002 01:31 PM
2 comments, last by Hostility 22 years, 6 months ago
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!
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!
Advertisement
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.
Thanks, my hunch was the same as yours. Did a little snooping and found my answer. Thanks people.

This topic is closed to new replies.

Advertisement