Hey,
question = you ve a tree of items which correspond to osg nodes ? and whenever
you select any of them you wish to show "it selected " ???
If so :
Code:
const osg::Vec4 normalColor(1.0f, 1.0f, 1.0f, 1.0f);
const osg::Vec4 selectedColor(1.0f, 0.0f, 0.0f, 0.8f);
void setSelected(bool value)
{
osg::ref_ptr<osg::Material> mat = new osg::Material;
auto color = value ? selectedColor : normalColor;
mat->setDiffuse(osg::Material::FRONT_AND_BACK, color);
mModel->getOrCreateStateSet()->setAttributeAndModes(mat,
osg::StateAttribute::ON);
mModel->getOrCreateStateSet()->setAttributeAndModes(mat,
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
}
If its a wrong answer sorry - i didnt understand well !!![/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72485#72485
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org