Butler, Lee Mr CIV USA USAMC wrote:
I want to highlight certain nodes (or de-emphasize others) without
killing performance (I'm at the lower limit already) or requiring a
second render pass. Any good suggestions?
I was thinking of setting temporary colors.  What is the appropriate OSG
way to change the color on something temporarily?  For example, setting
the color on "picked" items or "items not picked".  I'm thinking a
StateSet that gets applied to all the nodes?

Easiest way would be to use an osg::Material in OVERRIDE mode. For example, this would turn all of the geometry bright red (regardless of lighting):


osg::StateSet *ss = pickedNode->getOrCreateStateSet();
osg::Material *mtl = new osg::Material():
mtl->setAmbient(osg::Material::FRONT_AND_BACK,
               osg::Vec4(0.0, 0.0, 0.0, 1.0));
mtl->setDiffuse(osg::Material::FRONT_AND_BACK,
               osg::Vec4(0.0, 0.0, 0.0, 1.0));
mtl->setSpecular(osg::Material::FRONT_AND_BACK,
                osg::Vec4(0.0, 0.0, 0.0, 1.0));
mtl->setEmission(osg::Material::FRONT_AND_BACK,
                osg::Vec4(1.0, 0.0, 0.0, 1.0));
ss->setAttributeAndModes(mtl, osg::StateAttribute::ON |
                        osg::StateAttribute::OVERRIDE);


--"J"


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

Reply via email to