Hi, i'm looking for give to an 3d object, some transparent value (not completely transparency) . So, i'm starting from osgclip example, to make trasparent (with 0.5 opacity) the wireframe part of the cow.
part of the c++ code : osg::Node* decorate_with_clip_node(osg::Node* subgraph) { ... float Opacity=0.5; osg::Material * material = (osg::Material *) wireframe_subgraph->getOrCreateStateSet()->getAttribute(osg::StateAttribute::MATERIAL); material->setTransparency(osg::Material::FRONT_AND_BACK, 1. - Opacity); wireframe_subgraph->getStateSet()->setRenderBinDetails(0, "transparent"); wireframe_subgraph->getStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON ); wireframe_subgraph->getStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); wireframe_subgraph->getStateSet()->setAttributeAndModes(material, osg::StateAttribute::OVERRIDE); wireframe_subgraph->addChild(subgraph); rootnode->addChild(wireframe_subgraph); ... At runtime, at : material->setTransparency(osg::Material::FRONT_AND_BACK, 1. - Opacity); i get the following error : Access violation in the writing of the address ... and the check is on the following methods: void Material::setTransparency(Face face,float transparency) { //clampBetweenRange(transparency,0.0f,1.0f,"Material::setTransparency()"); if (face==FRONT || face==FRONT_AND_BACK) { _ambientFront[3] = 1.0f-transparency; // I get error here _diffuseFront[3] = 1.0f-transparency; _specularFront[3] = 1.0f-transparency; _emissionFront[3] = 1.0f-transparency; } if (face==BACK || face==FRONT_AND_BACK) { _ambientBack[3] = 1.0f-transparency; _diffuseBack[3] = 1.0f-transparency; _specularBack[3] = 1.0f-transparency; _emissionBack[3] = 1.0f-transparency; } } Could you suggest me to solve this problem? Thank you! Cheers, Andrea ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37885#37885 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org