Hi Peter,

If you want to override the vertex colours on the drawables (shapes or
geometries) in your subgraph then you'll need to set the materials
ColorMode to OFF. osg::Material::s/getColorMode(..) maps to
glColorMaterial functionality in OpenGL so have a look at OpenGL docs
to see the reason for this behaviour - it's a bit convoluted to type
into an email.

Robert.

On Thu, Sep 18, 2008 at 8:26 AM, Peter Wraae Marino <[EMAIL PROTECTED]> wrote:
> 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( new
> osg::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/[email protected]/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
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to