glDrawElements and friends....

Hi !

Is glDrawElements any faster then glVertex if I use iu as it is (no nVIDIA extensions, just ordinary ram) ?

I have a lot of meshes to render, but they are split up in objects and each object is changed now and then so using display lists is no good idea, I am trying to find the best solution that works on “all” OpenGL implementations (at least all non software OpenGL’s).

Mikael

The main advantage of pure vertex arrays (without extensions) is simply that they use fewer function calls to get the same effect. There are a few other details that make vertex arrays faster, but that’s the main thing.

The benefit of pure vertex arrays is not only that there’s less function call overhead (important in and of itself) but also that you can get vertex re-use. A typical software implementation will mark transformed vertices as “transformed” and not re-do the work when you reference a vertex a second (third, fourth, …) time within the same index array.

Also, for HT&L cards, larger vertex buffers will be copied by the driver into an AGP area, from which the card can pull it asynchronously, and the driver can meanwhile return to your program. Thus, your program only has to pay the cost of finding the maximum and minimum index values, and the memory copy; transform/rasterization may be overlapped for you.

Last, if you use “regular” vertex arrays, you can still get a speed-up by using the LockArrays extension (especially if you multi-pass) and/or using the NV_vertex_array_range extension where available. I e, your code looks the same except for a possible call to VertexArrayRangeNV at the beginning, and possibly bracketing your drawing with LockArraysEXT/UnlockArraysEXT.