tags:

views:

73

answers:

3

I'm rendering 2D polygons with the GLUTesselator the first time, then they are stored in a display list for subsequent use. I think VBO's might be faster, but since I can't access the stuff that the tesselator outputs, and since it uses mixes of gl_triangle, quad, strip etc, i'm not sure how I could do this, even though I would like to use VBO's once the GLUTesselator is done with them for optimal performance. Thanks

+1  A: 

It's been a while since I've used the GLU tesselator, but as I recall it just adds standard triangles to your vertex list. One of the callback functions that you pass into it will be receiving the new vertices and putting them somewhere. This happens in your code, so the data isn't hidden from you.

Display lists are better than rendering in immediate mode, but generally they are a very poor choice compared to VBOs.

Update: "Professional"-market OpenGL drivers like Quadro and FireGL will have more effort put into their display list implementation than consumer level cards. But even then the amount of optimization that they can do is much less than old-school 3D programmers from the SGI days think they get. The display list is supposed to capture state changes and other factors, but still take into consideration other states that may change independently of the display list.

It's been a couple years since I had hard information on current driver implementations, but at point a display list would hold your geometry data in software and upload them like a plain vertex array since it may need to know certain gl states to make adjustments to the data before uploading to GPU memory. Basically, a display list gives you theoretical flexibility to make changes at execution time that it needs to know before it can upload the data. A VBO locks down the format in a way that can go straight into memory at creation time.

Alan
I never experienced display lists to be worse than VBOs. Actually, they should be implemented very similar.Can you provide more information on this?
zerm
oh, and +1 because hint with callback. Probably VBOs are most likely always better (though possibly just slightly) but as you have full control over them, i guess that's the way to got
zerm
@zerm: see edit
Alan
It's also worth adding that Display Lists are formally deprecated in the newer versions of the OpenGL spec.
Alan
A: 

I disagree with Alan on the idea that display lists are always a very poor choice compared to VBOs. I see this depending heavily on the driver and the actual usage, and in some circumstances a DL might be even superior. So, If you could go for VBOs somehow, I guess you should - but as you are using "legacy" GLUTesselator stuff anyways, I think staying with DLs is not that bad at all.

I have not yet tried, but I found these folks comparing VBO vs. DLs: http://www.mofeel.net/312-comp-graphics-api-opengl/1470.aspx

You might want to try yourself. I remember from the last test for a practical case from my work, I noticed no difference between DL and VBO on top-end hardware. As already mentions, I think this depends on driver and usage, though.

zerm
A: 

Since your geometry is 2D, display lists are probably a better choice.

  • You already have them working.
  • Cards new enough to support FBO are fast enough that even if display lists are 1/10 the speed of FBO, it will still be fast enough
  • Display lists also work on older cards that don't have FBO support, but still are plenty fast for 2-D geometry
Ben Voigt