Create a Triangle Strip from unordered 2d points.

Hello,

I am attempting to draw a set of points as triangle strip.

To do this, all of the vertices should be in a vertex buffer, and the colours in a colour buffer.

If i use a delaunay triangulation, however, this will not necessarily return a list of triangles that are in an order appropriate for correct rendering.

So, given a std::vector<Point>.

How is it possible to sort these points?

Regards,

Daniel

A triangle mesh cannot necessarily be represented as a single triangle strip.

And if the points used for the Delaunay triangulation correspond to anything resembling a uniform sampling of a region, it’s unlikely that the resulting mesh can be represented as a single triangle strip.

So you basically have two options: glDrawElements(GL_TRIANGLES) or convert the mesh to multiple triangle strips. I’d suggest the former unless there’s a compelling reason to use strips (and the only one I can think of is that you’re stuck with some existing software which requires strips).

Awesome.

So with GL_Triangles, the points do not need to be in order?

[QUOTE=MrCybin;1282992]Awesome.

So with GL_Triangles, the points do not need to be in order?[/QUOTE]

with glDrawArrays(GL_TRIANGLES, …); 3 consecutive points have to build a triangle
0, 1, 2
3, 4, 5,
… etc

With glDrawElements the order comes from the indices, but the vertices can be in any order. Obviously it’s going to be more efficient if the vertices are in (at least reasonable) triangle order, but it’s not a constraint.