Is there a command to delete all display lists?

Started by
6 comments, last by DudeWonder 17 years, 4 months ago
I'm looking for a command that deletes all display lists. Kinda like a super command that will free the memory allocated for all the display list used in the device context. It would be too complicated to track all the IDs generated so I was wondering if there was a command I could use. Is there a way I can use glDeleteLists with some special parameter that will delete all of the display lists created. Thanks for looking.
Advertisement
No. You have to delete all names manually.
You could loop through a reasonable amount of integers and delete these list id's.. I don't know if thats a good idea or not but it should work.
You must be keeping trak of them somewhere!

How else can you pass them to opengl to draw?

If you are using a language like c++, you can make the destructors of objects clean up the display lists they use.
Of course there is.

glDeleteLists()

When you generate your display lists:

start = glGenLists(100);

This will create 100 display lists starting at display list ID "start".

To destroy those display lists in a single shot, call:

glDeleteLists(start, 100);

It is very common to do this technique when doing bitmap based fonts in OpenGL. To write the character "A" on the screen, you could just do glCallList(start + 'A'), provided you've created the display list that renders the "A" for you.

The only thing you need to track is the starting ID ("start").

I should add, the cost of creating a name for a display list (in terms of memory) is something like 4 bytes per name plus list maintenence, so it is low.

Just generate a bunch ahead of time and it can be your tracker. This is a little sloppy, but no more memory consuming than if you tracked it yourself.

Take a look at Mesa or the SI implementation of OpenGL to see how this works internally.
Thanks for the replies. The program keeps track of all the display lists. They are cleared upon deletion but since the rendered data is very complex, deleting all the lists isn't so simple. I wanted this just for testing because I think there are some display lists that I am not deleting and wanted a quick and easy command I could execute when I wanted and then check the memory usage of the program. Anyway, I'm sure I'll be able to figure out something with the replies you guys gave me.
Thanks for the replies. The program keeps track of all the display lists. They are cleared upon deletion but since the rendered data is very complex, deleting all the lists isn't so simple. I wanted this just for testing because I think there are some display lists that I am not deleting and wanted a quick and easy command I could execute when I wanted and then check the memory usage of the program. Anyway, I'm sure I'll be able to figure out something with the replies you guys gave me.

This topic is closed to new replies.

Advertisement