The code I posted will work for the use case you describe. Indices are part
of the PrimitiveSet; assign a different PrimitiveSet (with different
indices) to each Geometry and they will index into the same vertex array.
   -Paul
 


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Aitor
Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Sharing Vertex Arrays between Geometry Nodes


Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is
not as simple as you think. Sorry because it was my fault as I did not
explain myself correctly.

The problem is that I must have a single vertex arrays for many different
geometries but each geometry uses only a part of this vertex array.. That
is, imagine a single vertex array with indices from 1 to 100. I should have
geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20,
etc. But all of them sharing the same vertex array, which is used to do some
other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <[EMAIL PROTECTED]>
Para: OpenSceneGraph Users <[email protected]>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: [osg-users] Sharing Vertex Arrays between Geometry Nodes


osg::Geometry* geom0 = new osg::Geometry;

osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );

geom1->setVertexArray( verts );
 
Hope that helps.
   -Paul


  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Aitor
Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To: [email protected]
Subject: [osg-users] Sharing Vertex Arrays between Geometry Nodes


Hi all,
 
I am developing an application in which I have to share the same vertex
array between different nodes in order to apply a different texture to each
of them. I know that this is possible to do because I have read it. However,
I am a beginner in the osg world and I am not able to find the way to do it.
 
Someone told me that I could use the same geode having different geometries
but how can I specify a vertex array for a geode? As far as I know this is
impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but
how should I use it?
 
My question is: is there any example of sharing vertex arrays between
geometry nodes anywhere? Or has anybody done this before? In short, could
anybody please help me with this task?
 
Thank you very much in advance.
 
Regards,
 
Aitor



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to