Hi,
I used osgFX easily but it seems the solution of osgscribe looks nicer (i.e.
the wireframe color is the same of the surface but a little darker)
Code:
osg::StateSet* stateset = new osg::StateSet;
osg::PolygonMode* polymode = new osg::PolygonMode;
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
osg::Material* material = new osg::Material;
stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF);
decorator->setStateSet(stateset);
Now I need to switch the wireframe on and off.
To remove the wireframe, the following code does not work:
Code:
osg::StateSet* stateset = decorator->getOrCreateStateSet();
osg::StateAttribute* attribute =
stateset->getAttribute(osg::StateAttribute::POLYGONMODE);
stateset->setAttribute(attribute, osg::StateAttribute::OFF);
But it works with:
Code:
osg::StateSet* stateset = decorator->getOrCreateStateSet();
stateset->removeAttribute(osg::StateAttribute::POLYGONMODE);
Is it correct for switching from wireframe on and off to create new
osg::PolygonMode every time and then respectively remove that attribute? Or is
there a better implementation?
Regards,
Gianni
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60791#60791
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org