Hi users,

I'm trying to apply a material color to a shape. I assume material color is
a state and can be applied to the group that contains the shape.
This being said the basic code looks like this:


osg::Group* pGroup = new osg::Group;
osg::Geode* pGeode = new osg::Geode();
pGeode->addDrawable( new osg::ShapeDrawable(
newosg::Capsule(osg::Vec3(8.0f,0.0f,1.0f),0.5f,3.0f) ) );
pGroup->addChild( pGeode );

osg::Material* mat = new osg::Material();
mat->setColorMode( osg::Material::DIFFUSE );
mat->setDiffuse( osg::Material::FRONT_AND_BACK, osg::Vec4(0.0, 1.0, 0.0,
1.0) );
pGroup->getOrCreateStateSet()->setAttribute( mat, osg::StateAttribute::ON );

I would expect my capsule to be green.. but it's still gray?
searching the archive I fould this:
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg04463.html
and he states at the bottom that osg::Material can be used with shapes

so,.. am I missing something? Can someone shed a little light and give me a
push in the right direction.

-- 
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to