Hello, I tried what you said, but it doesn't work.
Do you see an error in my code ?


Code:
osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere(osg::Vec3f(0.0, 0.0, 0.0), 
.5f);

osg::ref_ptr<osg::ShapeDrawable> sphereDrawable = new 
osg::ShapeDrawable(sphere.get());
sphereDrawable->getOrCreateStateSet()->setMode(osg::StateAttribute::BLENDCOLOR, 
osg::StateAttribute::ON);
        
osg::ref_ptr<osg::Geode> sphereGeode = new osg::Geode();
sphereGeode->addDrawable(sphereDrawable.get());


osg::Matrix I = osg::Matrix::identity();
osg::ref_ptr<osg::MatrixTransform> mtI = new osg::MatrixTransform(I);

mtI->addChild(sphereGeode.get());

double x = 0.0;
for (int k = 0; k < 10; k++) {
        osg::ref_ptr<osg::PositionAttitudeTransform> patSphere = new 
osg::PositionAttitudeTransform();
        
        patSphere->setPosition(osg::Vec3f(x, 0.0, 0.0));
        
        if (k == 5) {
                osg::BlendColor* bc = new osg::BlendColor(osg::Vec4(1.0, 0.0, 
0.0, 1.0));
                patSphere->getOrCreateStateSet()->setAttributeAndModes(bc, 
osg::StateAttribute::ON);
                
patSphere->getOrCreateStateSet()->setMode(osg::StateAttribute::BLENDCOLOR, 
osg::StateAttribute::ON);
        }
        
        patSphere->addChild(mtI.get());
        
        root->addChild(patSphere.get());
}



Thanks. :)

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26754#26754





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to