HI Martin,

On Wed, Apr 7, 2010 at 9:27 PM, Martin Beckett <[email protected]> wrote:
> Don't know if it applies to OSG, but a common speedup with OpenGL used to be 
> to sort by vertex color so you draw all the vertex of the same color at once.

Was this in the glBegin/glEnd days?

> That might be out of date with modern cards and VBOs but shouldn't be too 
> difficult to implement.

With modern cards they just send all the vertex attributes required in
the vertex shader into the shader so it won't make a difference
whether the colour values change or not.

A small possible benefit might be gained If you did sort by colour and
the batches of the same colour were long enough to justify using a
single glColor instead of a color array per batch.   This would save
on memory and bandwidth, but if you made the batching too small then
the cost of too many small batches would outweigh this completely and
you'd end up with worse performance.   I would only expect a
performance benefit if the batches could be kept to over a thousand
vertices or so - i.e. you had continous blocks of same colour in a
array that you can group together.

This sorting isn't just something that could be done for colour, but
for all vertex attributes save for the vertex array, however, the same
batching granularity issues apply, if you can't keep the batches very
large then it's counterproductive.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to