[osg-users] Manipulating the diffuse color in the entire scene

Robert Osfield robert.osfield at gmail.com
Mon Jul 23 09:13:49 PDT 2007


Hi Ofir,

Material::setColorMode(ColorMode mode) is what you need to set, i,e,

  material->setColorMode(osg::Material::DIFFUSE);

In OpenGL docs see the second on glColorMaterial.

Robert.

On 7/23/07, Ofir Ofir <ofirosg at gmail.com> wrote:
>
> Hello!
>
> I would like to use a node with a special StateSet, so I can force the
> diffuse color in the entire scene (which is added as a child to the node) to
> be (0,0,0,1).
>  I tried doing so with the attribute Material:
> "
> node->addChilde( entireSceneNode );
>
> state = node->getOrCreateStateSet();
>
> material->setDiffuse( Material::FRONT_AND_BACK, Vec4( 0, 0, 0, 1 ) );
>
> state->setAttributeAndModes( material.get(), StateAttribute::ON |
> StateAttribute::OVERRIDE);
> "
>
> But the result was that the ambient,specular,shinness etc. was changed as
> well. How can I force the diffuse color alone on the entire scene?
>
> Thanks!
>
> Ofir
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


More information about the osg-users mailing list