Hi Akilan,

statSet->setMode(GL_LIGHTING, osg::stateAttribute::OFF);

[...]

osg::ref_ptr<osg::Material> material=new osg::Material;
material->setAlpha(osg::Material::face::FRONT_AND_BACK,0.5);
statSet->setAttribute(material.get());

As Paul mentioned in a previous message in this thread, you need lighting ENABLED to be able to use materials. Otherwise the material has no effect.

Note that setAlpha might not do what you want - it sets the alpha of ambient, diffuse, specular and emission colors. I think you'd probably just want to set the alpha of the diffuse color, something like

osg::Vec4 diffuse = material->getDiffuse(osg::Material::FRONT_AND_BACK);
diffuse.a() = 0.5;
material->setDiffuse(osg::Material::FRONT_AND_BACK, diffuse);

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to