Hi,

I'm currently on a problem :

I change the color of a node (osg::PAT) but I don't want its child osg::text
to have the same color...

On the PAT I do a
node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON);

On the text :

    osg::ref_ptr<osg::Material> mat =
(osg::Material*)text->getOrCreateStateSet()->getAttribute(osg::StateAttribute::MATERIAL);
    if(!mat.valid())
        mat = new osg::Material;


mat->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));

mat->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0,0.0,0.0,1.0));

node->getOrCreateStateSet()->setAttributeAndModes(mat.get(),osg::StateAttribute::ON
| osg::StateAttribute::PROTECTED);


The text is in a geode, under the PAT.


Any idea ? thanks a lot.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to