# Display Lists

This topic is 4809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In my tetris game I generate a display list
GLuint dl = glGenLists(1);

and compile it
glNewList(dl, GL_COMPILE);
// ... some meaningful stuff
glEnd();
glEndList();

If I want my display list to change, can I just compile it again, or do I have to call glDeleteLists and glGenLists once more before compiling? I googled for half an hour, but I only find "static" examples of display lists.

##### Share on other sites
i've always just deleted it, then re-created it. Never had a big problem with that. If your data is constantly changing then you might want to look at vertex arrays or VBO's

##### Share on other sites
Display lists are designed for static data which is why you'll only find static examples. In an editor recompiling on the fly probably wont cause you problems however in a game situation the recompile can crash your framerate (as recompile time isnt constant) and it could interact strangely with other part of the game rendering.

If you want dynamic data, use a dynamic system.

##### Share on other sites
As said above, for quads or cubes in a tetris game, display lists work fine. Plus, if you don't set the color, rather just the verts in the list, you can change the color and or texture at run-time according to what block it is, without recompiling the list. If you need verts that change as well, try using vertex arrays instead. Most people say they provide about the same speed up overall, but vertex arrays can change at runtime, so they work diffently. NEVER re-compile a list at run-time, unless it is a slow app in which speed doesn't matter. Even as slow processing as Tetris is, don't do it. Just change the color and leave the color out when you compile the list, and the renderer will use the current color when you call the list.

1. 1
Rutin
19
2. 2
3. 3
JoeJ
16
4. 4
5. 5

• 27
• 20
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001790
×