openglgl-triangle-strip

Triangle strip and degenerate triangles


My question could be stupid but I didn't find good example of triangle strip utilization:

https://i.sstatic.net/KL8jk.png

With vertices like that:

A: -0.5f, -0.5f,  // Bottom left.
B: -0.5f,  0.5f,  // Top left.
C:  0.5f, -0.5f,  // Bottom Right.
D:  0.5f,  0.5f   // Top right.
----------------------------------
B--D
|\ |
| \|    
A--C    

Sometimes, in examples, we can find this configuration:

or this:

What is right? I've tried both and both works.

Now I would like to use degenerate triangle to merge two square.

B--D    F--H    
|\ |    |\ |    
| \|    | \|    
A--C    E--G    

Here is what I've got:

ABCD + DEEF + EFGH

But here again, I've got some artifacts sometimes.


Solution

  • If you use backface culling, the two configurations would not produce the same result. In the ABCD case, BCD is counterclockwise, whereas in the ABCCBD case, CBD is counterclockwise. The right way to draw two quads would depend on whether you care about orientation. I would suggest ABCDDEEFGH.