Hi Mao, I'm not sure if I understand you correctly, but if you set in node1 a diffuse material with alpha set to 0.0 and the statset is OVERRIDE, if subnodes are not PROTECTED or OVERRIDE then they get the same material, so they become "invisible".
is it problably the problem? Try to set diff to osg::Vec4 diff(0.0f, 0.99f, 0.9f, 1.0f); Rafa. On Wed, Jan 21, 2009 at 7:27 AM, Mao.. <[email protected]> wrote: > Hi, everyone! I'm on a small program and I meet a problem. These are what > we do: > > 1. click on a model, and then use osgUtil::PolytopeIntersector and related > methods to find which model has been clicked (selected). > > 2. and the scene is like this: node1->node2->node3->leaf > > 3. after find the leaf and we trace back to node1 > > 4. we give a stateset with a blue material to node1: > osg::Vec4 diff(0.0f, 0.99f, 0.9f, 0.0f); > osg::ref_ptr<osg::Material> pMaterial = new > osg::Material; > > pMaterial->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); > pMaterial->setDiffuse(osg::Material::FRONT_AND_BACK, > diff); > > pStateSet_of_Node1->setAttributeAndModes(pMaterial.get(), > osg::StateAttribute::OVERRIDE); > > 5. some models are quite successful with this way, but some models just > become invisible. > > 6. I check the invisible models and find a stateset of their own node2, it > is like this: > StateSet { > rendering_hint DEFAULT_BIN > renderBinMode USE > binNumber 10 > binName DepthSortedBin > } > > 7. I did two tests: i). copy the code above to an osg file which was > successfu, and it fails and becomes invisible. ii) I append some codes to > those in step 4, and set the stateset of node1 with rendering options just > like step 6. Then everything just disappears. > > Can you help me out of this, I don't know whether I've explain this > clearly. > > Thank you! > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- Rafael Gaitán Linares Instituto de Automática e Informática Industrial http://www.ai2.upv.es Ciudad Politécnica de la Innovación Universidad Politécnica de Valencia
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

