Hi Colin,

If this isn't faster on other people's apps I'd like to know ( to
improve my own knowledge if nothing else ). It was Robert who suggested
that I use this technique and he said that Uniforms can be expensive and
that State changes should be minimised.

But then it's changing states that was costly, not state sorting?

I'm sure Robert's suggestion was accompanied with "in your case, since your scene is ..., then using vertex attributes will probably be faster". Indeed, if you have a very large number of small geometries, and each one has a different value for the uniform, this may be the case.

But as I said, the uniform changing for each and every object, and having lots and lots of objects, is rather a pathological case. Generally the uniform will have the same value for a batch of objects, and depending on the size of the objects (geometry etc.) changing the uniform will be insignificant compared to other things.

However using a Uniform per object is far easier, if it gives comparable
performance it is certainly the better option. It's more a case of
letting people know that there is a gotcha that comes with the heavy use
of Uniforms and that there is a way around it using techniques in the
osgexamples.

Of course, there are many ways to skin a cat. You have to remember too that you can have many more uniforms than attribute arrays, so depending on the number of values you need you may have no choice...

Interesting discussion in any case, it's always good to know there are some other options available to do what you need to do.

Thanks,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to