Hi Gianluca,

You can use the osg::Material StatAattributeto control colour - attach
this to a StateSet that decorate a subgraph and this state will be
inherted down to the leaves.  This only works when OpenGL lighting is
on though as it uses glMaterial to set the material parameters.  As a
general note glFunction maps to osg::Function.

Robert.

On Dec 18, 2007 2:19 PM, Gianluca Natale <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi all,
>
> I'm new to OSG.
>
> I cannot find a way to change the primary color of OpenGL in order to draw
> the same
>
> object twice in two different places with two different colors.
>
>
>
> I mean that in OpenGL I can do that in this way:
>
> glColor3fv(color1);
>
> // set model view matrix
>
> // draw object A
>
> glColor3fv(color2);
>
> //set model view matrix
>
> //draw object A
>
>
>
> Instead in OSG I should create two geodes with the same geometry, but
> different color,
>
> in order to do that. I tried to search a way to change the color in the
> osg::MatrixTransform,
>
> without finding it. Actually I don't want to duplicate the geometry data
> just to change a color!
>
>
>
> Furthermore, changing the primary color in an osg::Node would be really
> useful to
>
> quickly change the behavior of lit objects. I mean that in OpenGL I can set
> material properties
>
> by:
>
>
>
> glColorMaterial(...);
>
>
>
> and then change the behaviour just changing the primary color, before
> drawing the objects.
>
>
>
> I hope someone can help me.
>
> Thanks in advance,
>
> Gianluca Natale.
>
>
> _______________________________________________
> 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