Sign in to follow this  

Is there a command to delete all display lists?

This topic is 4019 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

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.

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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").

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

This topic is 4019 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this