Hi,

Considering I've created an osg::Material this way, and that the nodes are 
shown on screen :


Code:

m_material_selected = new osg::Material();
m_material_selected->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.2f, 
0.2f, 0.75f, 0.5f));
m_material_selected->setSpecular(osg::Material::FRONT_AND_BACK, 
osg::Vec4f(0.2f, 0.2f, 0.75f, 0.5f));
m_material_selected->setShininess(osg::Material::FRONT_AND_BACK, 75.0);
m_material_selected->setColorMode(osg::Material::AMBIENT);




And then I set it to a node like this ( this is apparently working so far ... ) 
:


Code:

// Where node_sel is a previously created osg::Node*
node_sel->getOrCreateStateSet()->setAttribute(m_material_selected, 
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);




But when I try to remove this attribute from the previously created node like 
this :


Code:

// Where node_unsel = node_sel;
node_unsel->getOrCreateStateSet()->removeAttribute(m_material_selected);




My app crashes.

What did I do wrong ? Is it unsafe to removeAttribute from a node this way ?
I've seen on the forum things like NodeVisitor class, should I be using this or 
can I change nodes manually ?


Thank you for your interest in my question,

Have a good day,

Paul

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72479#72479





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to