Advertisement

Generate Display Lists at Run-Time(Possible?)

Started by November 05, 2004 09:35 AM
2 comments, last by Krohm 20 years, 1 month ago
I'm starting an OpenGL engine from scratch here, and wondering if it would be appropriate to use Display Lists to manage the meshes at run-time. For example: Load up a House map that is completely empty and therefore no object meshes are loaded. I spawn a Sofa object, which executes several "glColor3f" and "glVertex3f" operations as dictated by the external file. Would it be possible to execute an arbitrary number of vertex/color/texture operations in a Display List at run-time? Is there a better way?
CVAs or VBOs might be a better way to go, but yes your Display list generation at runtime is possible. I do the same thing in my application (a flight sim) that generates a user requested precision and runway lighting configuration. For example, the user loads a particular airport, and that airport reference file contains references for the user to specify lighting types and positions (MALSF, ALSF, VASI, PAPI, etc.) The application gathers information about runway position, length, etc. and then dynamically generates the light fields. It works well and is quite speedy so I haven't bothered to convert it to VBO, etc.

J
Advertisement
Display list objects are essentially a group of gl functions that can be sent to gl and reused like a template. They are usually (almost entirely always) calculated at load time. That said, it is appropriate to use a display list only if the order and values passed to the function never change.

In terms of poly based modeling ect display lists are very useful. If you have a model like a sofa that will never change then you can create a display list out of it and whenever you need to draw the sofa, just call the display list.

Display lists can also be useful for animated meshes. The trick here is to display list the parts of the model that are static (this is kinda tricky). For example, when you bend your elbow, the bones in your forearm dont bend as well (so they can be display listed). You get a speed bost because you can position your static mesh using the modelview matrix. This is as apposed to using your own matrix stack to calculate the final position of the resulting vertices (which also go through the modelview matrix as well).
Quote: Original post by llvllatrix
Display list objects are essentially a group of gl functions that can be sent to gl and reused like a template. They are usually (almost entirely always) calculated at load time. That said, it is appropriate to use a display list only if the order and values passed to the function never change.

I just wanted to bump on it again.
My personal experience is that display lists take some time to compile. I guess it takes much longer than just declaring a VBO or something. The sad truth is that you can see the hiccup.
Once they are compiled, they are just a little slower than the fastest VBO available. On my system the difference is less than 10% however so take this with some salt.
I personally would raccomand VBO all over but if the geometry never changes... well, it's fine with display lists anyway.
Conceptually speaking, VBOs are "specialized display lists" just as texture objects are. In GL1.0 everything used to be in a display list and then the interface was refined to handle special cases.
Quote: Original post by Jehsup
CVAs or VBOs might be a better way to go...

Hykes!
CVAs, which are Compiled Vertex Arrays are OUTDATED! Do not use them unless you already have them in your app and you don't have time to pull them away.
If forum' search option is running, you can find quite a bit of discussions about them and why they are bad, in the meantime, trust me when I say they don't provide any speedup. In some cases they could give a minimal slowdown.

Previously "Krohm"

This topic is closed to new replies.

Advertisement