glDeleteLists and glDeleteTexture

Started by jam007, March 05, 2005, 10:23:25

Previous topic - Next topic

jam007

I have tried to understand how to use glDeleteLists and glDeleteTexture....
IÃ,´m using the lists I create during the whole game. Is it important to delete the lists as the game ends or will the memory used be freed anyway? (I saw a DeleteLists in the finalize method of a Font creation class but that is the only place so far I have seen it in any example.)
After creating the texture I have an int handle for the texture but the glDeleteTexture uses a buffer. Can I delete a texture using the handle in some way if needed?

Anders

princec

Actually once your process exits you don't have to worry about cleanup. The drivers take care of it for you. In fact, just destroying the context will destroy anything else attached to it as well.

glDeleteTextures needs a direct IntBuffer, and in the int buffer you should place the texture handle number. A bit long winded but that's just how GL works.

Cas :)

jam007

QuoteglDeleteTextures needs a direct IntBuffer, and in the int buffer you should place the texture handle number. A bit long winded but that's just how GL works.

Ah! Thanks! Now I understand.
Might be usful in the future. We have textured sails and it might happend that one player exits the game but other continues playing.
The game: http://sourceforge.net/projects/iceboatgame/

As I understood from erlier postings in this forum you should avoid using glDeletexxx in finalize due to thread issues. It is better to call these methods directly. Is that correct?

Anders

princec

Yes. The finalizers are run in their own thread, at a completely indeterminate point in the future. They are next-to-useless for OpenGL resource management.

I've been trying to figure out something using ReferenceQueues that's more reliable.

Cas :)

jam007