Accessing a VBO inside a display list

My app displays static geometry. I decided to add VBO support to see if it would effect performance. Up until now, I was was just using display lists and standard vertex arrays.

On my ATI 9700 Pro with Catalyst 4.1 drivers, it crashes when it gets to the glDrawElements() call if the glDrawElements() call itself is in a display list. As long as I don’t use display lists at all, my geometry draws as expected via VBO, so I believe my VBO code is correct. (It draws faster with display lists than VBO, but since my model tree walk isn’t optimized at all at the moment, I’m not particularly surprised.)

Looking carefully at the VBO spec, I was under the impression that a call to glDrawElements() inside a display list with a bound VBO should work fine. Is this not the case? Note that the spec does talk about the VBO interaction with display lists, and states that the actual gl*Pointer() calls will be exectuted immediately. However, these aren’t inside my display list, just the glDrawElements().

How are you building the display lists?

You cant build a display list with glDrawElements, and then set the vertex ptr’s up afterwards when you call the display list.

You must set the ptrs up to start with, create the display list, which will copy the contents of everything you’ve passed over, and then you can call the display list.

You dont need VBO or vertex pointers setup when calling the display list, as it just uses the data inside the display list.

Nutty

Originally posted by Nutty:
How are you building the display lists?

First, I activate the appropriate VBO, then I call the appropriate gl*Pointer() functions, then I build the display list. So all the appropriate things should be active at the time the list is compiled.

Sounds like a bug to me.

Probably. Try and repro it on some other hardware.

It is a bug and you should report it. That doesn’t mean that it will buy you anything if/when it does work correctly.

This is the same thing as with display lists and regular (system memory) vertex arrays. VA setup and submit is logically client side. Display lists store only server side stuff.
I.e. if you submit vertex data while compiling a display list - regardless of whether it’s immediate mode, from a regular VA source or from a VBO - the display list will store the geometry, not the array commands. You essentially generate a snapshot at DL compile time.

So you end up with two copies of your geometry, the first one being your vertex array or VBO, the second one is contained inside the display list, and these two are from there on separate. I.e. updating the VBO (or regular VA) afterwards will not change the display list.

This also means that your choice between sysmem VAs and VBOs when compiling won’t affect the rendering performance of the display list at all because both will produce the exact same display list contents.

[This message has been edited by zeckensack (edited 01-25-2004).]