Is there a way/class to set indices so that a random amount of vertices (position) generates a mesh?

Is there a way/class to set indices so that a random amount of vertices (position) generates a mesh?

I want to load a mesh with a random amount of vertices.
Now I’m looking for a way to add indices for each vertex en draw it with GL_TRIANGLES or GL_TRIANGLES_STRIP so a solid mesh is drawn.

Is there an algoritm for this or a class ?

Hi @bobby,

I’m not sure what you mean by “random amount of vertices”, but you can use addIndex() or addIndices() from ofMesh to (re)construct a mesh from scratch.
You can refer to the documentation (link) for an example.

Does this help?

Hey, thank you for the reaction.
In the end, what I want to do, is to use a Kinect v2 to make a depth picture of for example me.
Then I want to make a point cloud of it and of these points I want to make a mesh.
Will I have to figure out the indices for each triangle myself or will it load the indices so that the mesh will be created correctly, or is there some class that does that for us?

Hm, Delaunay triangulation or maybe Marching Cubes could probably work.

wow, this is exactly what I was looking for. Haven’t tried it yet but I will.
Thank you, so much, I will post some results or comments if I get it to work

1 Like