Hi.

What is the idea behind having a color in ShapeDrawable?

What this means, is that if you create a ShapeDrawable,
and stitch a material in a node above it, you cannot control the color
through a material when lighting is disabled.

So if I would like to do:

material = new osg::Material;

stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
 
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED);

  material->setColorMode(osg::Material::OFF); // Diffuse color ==
glColor(diffuse);

Then control the color of this node by changing the diffuse color:

  material->setDiffuse(osg::Material::FRONT_AND_BACK,
osg::Vec4(1.0,0.0f,0.0f,1.0f));


It would render in white, due to that the ShapeDrawable applies a white
color!
Only way of changing this, would be to call ShapeDrawable::setColor()


Is there another way of achieving this?
(Except for skipping the use of ShapeDrawables completely).

/Anders
-- 
__________________________________________
Anders Backman, HPC2N
90187 Umeå University, Sweden
and...@cs.umu.se http://www.hpc2n.umu.se
Cell: +46-70-392 64 67
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to