Storing Display Objects

Hey all-

I’ve been working with OpenGL for a while, but my biggest problem is how to store the display lists. I have about 1000 complex polygons each requiring about 50 vertices to draw.

Options that I’m aware of:

  1. Put all the points for a single polygon into an array and put all the arrays into a list. Iterate across this list and create display lists to use later in the program. This is what I currently do, but it’s not very flexible.
  2. Put all the points for a single polygon into an XML entry and save all the entries into a larger XML document (or other file). Iterate across the document and create display lists for use later in the program.

Is there a way to compile the display lists and load them into the system since the lists are always the same? Even if they change if I can compile and drop the compiled module in with the executable that’d be great.

Any suggestions on this is very welcome!! :smiley:

As far as I know, no. You cannot “read back” the display lists from OpenGL and store them on disk for loading later to skip the recompile. If you use display lists, you have to compile them every time you run. How long does that really take for you? If not long, consider just doing that on startup every time.

As an alternative, you can optimize your batches yourself, store those as vertex arrays on disk, and load/render them using VBOs. However, with small batches like yours, the GPU will likely be underutilized because of CPU overhead for small batches. You can combine batches into shared VBOs which will help some. VAOs can help too. But to get the full display list perf with smallish batches, you’ll need to use NVidia bindless extensions, which (unfortunately) are still NVidia-only.