Thank you very much, that should solve my problem.

This way I need to duplicate just osg::Geometry objects, but they still
share

VertexArrays, NormalsArrays, etc. via ref_ptr. So I'm also sure that they
are destroyed only when the last

geometry is destroyed.

Thank you

Gianluca Natale

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz
Sent: Tuesday, December 18, 2007 3:34 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] changing colors of a geode

 

The best way to do this in OSG is to create two Geometry objects. Make them
both share the same VertexArrays, NormalArray, TexCoordArray (if you're
texture mapping), and PrimitiveSets. Then give each of them different color
arrays and specify a color binding of BIND_OVERALL.

 

Primary color, normal, texcoord, edge flag, etc., are not StateAttributes in
OSG.

   -Paul

 

 


  _____  


From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gianluca
Natale
Sent: Tuesday, December 18, 2007 7:20 AM
To: Osg Users
Subject: [osg-users] changing colors of a geode

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

Reply via email to