> > Attributes provide a faster way of changing vertex 
> properties even on 
> > a per object basis, as it means all of your objects can 
> share the same 
> > state. Changing the value of uniforms cause the creation of 
> a new state.
> > Lots of state changes can be very expensive.
> 
> Sure, but some types of state are less costly than others to 
> change. See
> 
> http://home.comcast.net/~tom_forsyth/blog.wiki.html#[[Renderst
> ate%20change%20costs]]
> 
That link doesn't quite work for me, but I think I found the blog entry
that you were trying to point me towards. As well as hardware state
changes he also talks about the CPU cost of doing the sorting being an
issue. That was what my suggestion will help with as it means that OSG
has less states to sort, as all objects of the same type will have the
same state as opposed to having state where the uniform changes.

> > Based on my experience of OSG, the performance 
> recommendations I have 
> > to give is that uniforms are to be changed between 
> different classes 
> > of objects ( no more than a handful per frame ). Anything more 
> > frequent should probably be set as a vertex Attribute.
> 
> Do you mean using vertex attributes in BIND_OVERALL mode? 
> Otherwise you'd be sending an array of n times the same value 
> for n vertices... So I'm sure that depends on the size of 
> your geometry and how often the same uniform value will be 
> reused between objects too.
> 
Yes, kind of. I actually implemented it by inserting Vertex Attribute
OpenGL calls in a draw callback, prior to the OpenGL rendering of the
actual geometry node.

Colin.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to