Hi J-S and Paul Thanks a lot for your reply. I would like to be able to have a correct model from the beginning but unfortunately I must use a given obj file...
So I don't have any option but trying to solve my problem by code. I have been doing some tests today and at this moment I'm able to separate the two geometries applying different textures for each of them and sharing the same vertex array but with different primitive sets. I'm still having some problems with the vertices near the neck but I think that I know how to solve them. Let's wait until tomorrow... I'm also having some strange problems with the light or something like that because I only see the textures from the back of the human figure. If I see the figure from the front everything is black... It's strange because when I had only a single geometry everything was ok and I have not set anything about lights after that... Maybe it could be a problem with the normals but if I remove the normal array from the geometries the problem is still there. Do you know what could be happenning? Thank you very much for your help. Regards, Aitor ----- Mensaje original ---- De: Jean-Sébastien Guay <[EMAIL PROTECTED]> Para: OpenSceneGraph Users <[email protected]> Enviado: miércoles, 15 de octubre, 2008 16:29:59 Asunto: Re: [osg-users] Sharing Vertex Arrays between Geometry Nodes Hi Aitor, > I can't use your code because I don't create new geometries. Instead of > this, I get an osg::geode from an obj file. At this moment, I can only > get a single geometry from the geode and apply a single texture to it. > But this is not what I want. > > The obj file represents a human figure, and I would like to separate the > head from the body because they have different textures. I know which > vertices are from the head and which ones for the body so this won't be > a problem in this case. The problem is that they must share the same > vertex array, which is used to do some morph tasks. My question is, how > can I create two different geometries starting from the same geode and > sharing the same vertex array? Is this possible or not? Your life would be simpler if you could get a correct model as soon as you load it, instead of trying to massage it (and how you massage it might change from one model to the next). However, yes, what you ask is possible. You can traverse your model to the Geode which contains the Geometry, then create new Geometry objects, attach them to the Geode, and remove the original one. The new Geometry objects can reference the original one's vertex arrays, and then when you remove the original one from the Geode the vertex arrays won't be deleted because other Geometry objects reference them. Then on your new Geometry object(s), you can do what you want. So you could add primitive sets for the correct vertices to be used, you could add texture coordinate arrays (or reuse those from the original Geometry object), etc. As I said, it's a lot of trouble. If you can get a valid model right away, your life will be easier. It's not the kind of thing that's best done in code... Modeling tools are specialized in manipulating these kinds of things... J-S -- ______________________________________________________ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ 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

