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