Dov
Dov

Reputation: 8542

Efficient ways to use GL_TRIANGLE_STRIP to cover a solid?

I am trying to understand using GL_TRIANGLE_STRIP to cover a simple polyhedron. I will use a cube as an example.

If I generate a cube with vertices as shown:

enter image description here

I can easily see how to cover the sides. The indices would be:

0 1 2 3 6 7 4 5 0 1

From there, I could do a degenerate triangle and then the top:

1 // degenerate triangle
3 5 7 // top

but then I would need to jump down to the bottom face, requiring another degenerate triangle at least:

7 6

and then presumably cover the bottom starting from 6:

0 4 2

I'm having trouble visualizing that, I could have that in the wrong order. Is there any better way to do it?

Similarly, scaling up to a sphere, is there any better way to draw it than as a triangle strip with degenerate triangles after each row?

Upvotes: 0

Views: 29

Answers (0)

Related Questions