display lists vs. vertex arrays

Started by
13 comments, last by Solias 19 years, 2 months ago
I'm researching vertex arrays for application in my current project. The project reads in object data from STL files, stores them in a big dynamic array, and displays the object in openGL. Presently I'm using display lists, but movement is somewhat choppy. The file I'm currently using is 3MB and the object is composed of over 65,000 triangles. This is the small file, too. The others will most assuredly be bigger, and I can only assume choppier. Will using display lists help? I've never used them before, so I'm not entirely clear on how they work. Are they just another mode of rendering that cuts back on function calls, as one call is made to pass in the array as opposed to one for each of three vertices? So would that just decrease the time to create the display list, but offering no run-time performance increase? Or does it do all of the above and automatically eliminate overlapping vertices, providing the very run-time optimization I require? If my assumptions are correct, it seems like vertex arrays are right for me. So are they? Are there any additional concerns/advantages? Can I use them in conjunction with display lists? Call the vertex array functions while building my lists to offer the performance increase of both? Thanks in advance!
Without order nothing can exist - without chaos nothing can evolve.
Advertisement
Did you mean..
Quote:
Will using vertex arrays help?


If so, it is my experience that the performance difference between vertex arrays and display lists is very close. The ease of use of display lists is almost unbeatable, however. It all comes down to if the vertex data needs to be dynamic or if it is static. I use VAs for example, with for my skeletal animation because it is constantly recomputed. But for the level I use a display list.
Take the cynical approach.

How may developers are using vertex arrays? how many are using display lists? I'd be willing to bet that more use vertex arrays.

This (usually) means it is less likely to be busted by driver writers (who have a less than stellar history of doing good things).
Quote:Original post by Optus
Did you mean..
Quote:
Will using vertex arrays help?


If so, it is my experience that the performance difference between vertex arrays and display lists is very close. The ease of use of display lists is almost unbeatable, however. It all comes down to if the vertex data needs to be dynamic or if it is static. I use VAs for example, with for my skeletal animation because it is constantly recomputed. But for the level I use a display list.


The object's shape is static. It's just composed of thousands of vertices which slows things down quite a bit. I'm just looking for a way to process it faster and wondering if vertex arrays are the answer.
Without order nothing can exist - without chaos nothing can evolve.
vertex arrays with VBOs should provide the best performance. Chances are its the size of the display list which is causing the issue.
break the mesh up into smaller meshes (eg a octree) stick each octree leaf node in a seperate DL/VA/VBO, stick a bounding box around the node, check to see if the BB is onscreen if so draw the node.
even if all nodes are onscreen this should be faster than your current method, draw calls dont like to much data per call eg 4*16384 is usually faster than 1*65536
Quote:Original post by _the_phantom_
vertex arrays with VBOs should provide the best performance. Chances are its the size of the display list which is causing the issue.


Thanks. Er..what's a VBO?
Without order nothing can exist - without chaos nothing can evolve.
VBO = Vertex Buffer Object
Its a way to put vertex data (possibly) into video ram, so it removes the transfer over head you normally get with vertex arrays (VA).
Quote:Original post by _the_phantom_
VBO = Vertex Buffer Object
Its a way to put vertex data (possibly) into video ram, so it removes the transfer over head you normally get with vertex arrays (VA).


Cool, I'll have to look into that.

So which rendering function am I going to want to call? It's looking like glDrawElements. Would glDrawArrays be even more efficient? And am I going to want to enclose all this into a display list or is that not doable/desirable?
Without order nothing can exist - without chaos nothing can evolve.
glDrawRangeElements is the most optimal path, with glDrawElements 2nd.
Both are better than glDrawArrays as they use indexed data which generally leads to a better reuse of the post-T&L cache.

glDrawArrays is indeed useable when you want to just throw vertices at the card, however the lack of indices mean that unless you use GL_TRIANGLE_STRIP as your draw mode you'll have to pump across alot more data, with the indexed calls above you can arrange your data as a triangle strip and then use GL_TRAIANGLES as the draw mode you can get the performance and data transfer characteristics without the need for either multiple calls to the triangle strips or having to use degenerate triangles to stitch two strips together to make it work in a single draw call.

This topic is closed to new replies.

Advertisement