Igor Lebedev wrote:
Hi,

Okay...
I get indices like that:

_indices = 
temp->asGroup()->getChild(0)->asGroup()->getChild(i)->asGeode()->getDrawable(0)->asGeometry()->getPrimitiveSet(0);
 //temporary; data existence is checked; i know it's bad

and then

indices[i] = (int*)(*_indices).getDataPointer(); //copy to 2-dimensional array 
by mesh index

Just to make sure you understand everything, some primitive sets include an index list, and others don't. You'll need to be sure you're accessing one of the DrawElements primitive sets to be able to get an index list.

If you're sure your PrimitiveSet is a DrawElements, try this instead:

  indices[i] = (*_indices)[i];

or

  indices[i] = _indices->at(i);

The first version is a direct access (and might be slightly quicker), and the second will do range checking and will throw an exception if you try to access something outside the bounds of the list. The DrawElements class itself is a descendant of std::vector, so you can just access it using the standard vector methods. You don't need to go all the way down to the data pointer.

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

Reply via email to