[osg-users] How do I disable material on a node?

Paul Martz pmartz at skew-matrix.com
Wed Jul 9 10:53:38 PDT 2008

Unlike OpenGL, OSG's Material class wraps both the glMaterial and
glColorMaterial features. Color Material redirects OpenGL to pick up
material lighting parameters from the primary color. So, you just need to
configure the OSG Material class to use Color Material, then lighting will
use the vertex colors.

> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org 
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Judie
> Sent: Wednesday, July 09, 2008 11:36 AM
> To: osg-users at lists.openscenegraph.org
> Subject: [osg-users] How do I disable material on a node?
> I am expecting this to work:
> osg::StateSet *stateSet = node->getOrCreateStateSet();
> osg::Material *material = dynamic_cast<osg::Material *>(stateSet-
> >getAttribute(osg::StateAttribute::MATERIAL));
> stateSet->setAttributeAndModes(material, osg::StateAttribute::OFF);
> I still see the material.
> The vertices have color values and material is something that 
> I want to be able to turn on and off. When I disable 
> lighting, then I see the vertex colors but I don't get any 
> contours of the object. I want to see the vertex colors and 
> the contours of the object but not the material properties 
> which have different colors as well as shine ...etc.
> I have also tried:
> stateSet->setMode(GL_COLOR_MATERIAL, osg::StateAttribute::OFF);
> any advice would be appreciated.
> Thanks,
> Judie
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce

More information about the osg-users mailing list