Hi Aurelien,

On 21 March 2012 09:20, Aurelien Albert <[email protected]> wrote:
> I've tested the solution based on the camera stateset, but it's not fuly 
> satisfying because when the leaf node object is remove from the graph, the 
> uniform and the stateset are still affected to the camera.

Could you just remove the uniform when you remove the leaf node?  Or
reset the uniforms value?

> So I'm interested by the positional state special case : how can I add a 
> stateattribute (uniform) to the positional state from a leaf node ?

Right now there isn't a mechanism in the OSG for treating uniforms as
positional state.  This is something I was expecting to need to
implement in some form in support of ShaderComposition, but it needn't
wait for this to be completed.  To have a positional uniform one would
need probably use a base Uniform that provides the basic value then
have the this Uniform cloned in the RenderStage and set to whatever
value is appropriate.  For an equivalent to gl_Light/gl_TexGen etc
you'd need to  multiple the value by the current modelview matrix.

One might also want a more general way of doing global uniforms as
well, where the modelview matrix isn't required, so it's isn't a
positional state.

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

Reply via email to