HI Peterakos,

Using removeAttribute(osg::StateAttribute::PROGRAM) should work.

To test whether it's working try writing the scene graph out to a .osg
or .osgt file by doing a
osgDB::writeNodeFile(*mySceneGraph,"before.osgt"); prior to doing the
remove then once again with "after.osgt" once the remove is done.  You
should in theory see the removal of the program.

If you don't then we have a bug in osg::StateSet, if you do then we
possibly have some errant behaviour elsewhere in the OSG or you scene
graph usage that is causing the state to not be affected in the way
you expect it to be.

Robert.

On 4 September 2012 21:18, Peterakos <[email protected]> wrote:
> Hello.
>
> I face a problem with a program attribute.
>
> I enable the program using this:
> osg::StateSet* stateset = model_node->getOrCreateStateSet();
> stateset->setAttributeAndModes( program, osg::StateAttribute::ON |
> osg::StateAttribute::OVERRIDE );
>
> and i disable it using:
> osg::StateSet* stateset = model_node->getOrCreateStateSet();
> stateset->removeAttribute(osg::StateAttribute::PROGRAM);
>
>
> Before the return viewer.run() , enable and disable operations work fine.
> But after that, only enable works.
> I use 2 buttons to enable and disable program in run time.
>
> what do i do wrong ?
>
> thank you.
>
>
>
> _______________________________________________
> 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