Display Lists

What are Display Lists?

Display lists are another technique to improve performance. You can make some gl* calls and OpenGL will save them and their parameters. After this you can execute those calls by calling the display list. This causes less overhead in the functions, and another aspect is, that there is no (time expensive) data transfer.

When should I use Display Lists?

Display lists are mostly used to store static objects. Note that it wouldn't be possible to render such an object like the "sphere" from the vertex array tutorial, because you cannot change any data in a display list (of course you can apply transformations to he whole list, but not to certain vertices). They are also used, when you have to compute their vertices - instead of computing them each time you render your scene, you can also store the results of your calculations in a display list. It would also be possible to use vertex arrays - ok. But there are some other differences: Vertex arrays don't need as much memory, sometimes you really have to care for that aspect. But display lists are generally a bit faster than vertex arrays. And one important thing is, that you cannot change state variable in vertex arrays (except the color, NVects and so on, of course). That means, it would be a bit more difficult to render an object with vertex arrays, when you have to use different material properties or want to change the modelview matrix.

Another field, where display lists are used, is when you write some simple text (or even 3d-text):You could create a list for each letter and write a routine, that calls the right list for each letter in a string.

Or you could create a list to make changes of state variables faster.

How can I use Display Lists?

First you have to get a number for your lists. This is done by Num = glGenLists(1). Now  you can call glNewList(Num, GL_COMPILE), make the calls that shall be stored in the list and the finish the list with glEndList().

This is already all you have to know, click here to see an example for display lists.



Any comments? Conact me!