[osg-users] Retrieve the triangles indices array from a geometry.

Dario Minieri paradox at cheapnet.it
Mon May 13 04:16:15 PDT 2019


Hello,

I need to retrieve the triangles indices from a geometry. 

I'm able to get all the verticies via getVertexArray() and then build an array that contains the getVertexArray() datas as list of scalars: [v1.x v1.y v1.z v2.x v2.y v2.z ... ]

I additionally need to build a bidimensional array that represent the interconnected coordinates like this:

static int gIndicesBunny[BUNNY_NUM_TRIANGLES][3] = {
	{126, 134, 133},
	{342, 138, 134},
	{133, 134, 138},
	{126, 342, 134},
	{312, 316, 317},
  ...
  ...
}

where the triplet is the list of indices inside the array of scalars described above. So a triplet contains the indices of interconnected coordinates for a triangle.

How I can do that?

Here is attached the complete BunnyMesh.h example.

Thank you!

Cheers,
Dario

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76099#76099



-------------- next part --------------
A non-text attachment was scrubbed...
Name: BunnyMesh.h
Type: text/x-chdr
Size: 38959 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190513/12890b61/attachment-0001.h>


More information about the osg-users mailing list