Hi Everyone, i am trying blending in OSG and i tried this code:
Code: osg::Geode* wireSphere = new osg::Geode(); osg::PolygonMode* polygonMode = new osg::PolygonMode(); osg::ref_ptr<osg::ShapeDrawable> sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,0,0), 3)); //polygonMode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE); wireSphere->getOrCreateStateSet()->setAttributeAndModes(polygonMode, osg::StateAttribute::ON); wireSphere->getOrCreateStateSet()->setAttributeAndModes(new osg::LineWidth(2.0f),osg::StateAttribute::ON); osg::StateSet* state = wireSphere->getOrCreateStateSet(); osg::ref_ptr<osg::Material> material = new osg::Material; // Set alpha to 0.1 material->setAlpha(osg::Material::FRONT, 0.4); state->setAttributeAndModes( material.get() , osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); state->setMode(GL_LIGHTING, osg::StateAttribute::ON); state->setMode(GL_NORMALIZE, osg::StateAttribute::ON); state->setMode(GL_BLEND, osg::StateAttribute::ON); // Turn on blending osg::BlendFunc* blendFunc = new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); state->setAttributeAndModes(blendFunc); wireSphere->addDrawable( sphere.get() ); But, i'm still getting an opaque sphere. Could anyone please tell me where i'm going wrong? Thanks, Mukund ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38740#38740 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org