PDA

View Full Version : display list question



09-13-2005, 09:07 AM
I have a question with regards to display lists and optimizations.

First, my code uses display lists. Yet, I'm tempted to use an array style implementation. eg. glInterleavedArrays with glDrawArrays.

Its my understanding that glBegin/glEnd pairs are to be avoided in immediate mode. So, I compile that into a display list. And things run fast.

So, they say I can edit the array. But I figure I can do that with a vertex program using the display list anyways.

I understand the display list puts things into an optimal format and onto the video card. Where the array implementation leaves the data in client space.

But the question is does using the array methods prove to be faster than my display lists? Is my display list going to have overhead of calling glVertex etc.

On more funky question, I assume I cannot put glInterleavedArrays with glDrawArrays in a display list?

Thanks for you patience.. :)

dorbie
09-13-2005, 09:29 AM
You can put glDrawArrays etc in a display list.

The thing is that the client data will be copied to the display list so you cannot edit it later.

Exactly how display lists are implemented is up to the implementor. Generally for nice big data sets it is well worth display listing if you don't need to modify the data. For small display lists it's not worth display listing because the overheads can outweigh the benefit. If display lists are not stored on the card they'll be DMA'd from memory (mapped space permitting). If you do not display list then arrays are a better option than glBegin glEnd data which is unpredictable by the driver and tends to get repackaged by the driver before dispatch anyway.

If you can edit your data in an efficient vertex program then that will very probably be more efficient to use a display list than touching vertex data with a program and holding the client arrays in system memory.

The results are highly implementation dependent.

You should look at VBOs as a means to classify your data and where it is stored by your type of useage allowing the driver to make smart choices about where to allocate and move the data and whether to lock or unlock and/or copy it for various operations.

VBOs with arrays is probably the best and most flexible option available and gets away from the two simple choices of setting display lists in stone vs storing data on the client side.