Hi Thomas,

There is only one osg::StateSet per osg::Drawable/osg::Geometry so if
you attach the osg::Program(and associated osg::Shader) directly to it
then you'll only have one for that geometry.

However, the OSG allows you to place osg::StateSet on any node the
scene graph, and inherits state top down, this allows you to override
the state on the drawable, as well as provide multiple paths down to
the drawable leaves of the scene graph, these multiple paths can
different StateSet associate with them and therefore provide different
state for a single drawable.

Note only does the state inheritance allow you to have multiple
shaders for each drawable, but it also enables you to use nodes in the
scene graph to enable/disable different shaders via osg::Switch or
NodeMasks.  The system as a whole is very flexible.

Robert.

On Tue, Aug 31, 2010 at 3:53 PM, Thomas Klemmer <[email protected]> wrote:
> Hi,
>
> First of, can I attach multible Shaders to one geometry node?
>
> I tried an it ran but obviosly only the last attached shader was rendered.
>
> Now is (if) there a way to toggle between these shaders?
>
> GeometryStateSet->setAttributeAndModes(programObject, StateAttribute::OFF);
>
> Has no effekt at all on any shader?!
>
> What am I doint wrong, workarounds?
>
> Thank you!
>
> Cheers,
> Thomas
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=31211#31211
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to