GL_TRIANGLE_STRIP vs GL_TRIANGLE_FAN


I need an example of a polygon that can be done only by GL_TRIANGLE_STRIP and another polygon that can be done only by GL_TRIANGLE_FAN.


Answers:


When knowing the difference between Triangle Strip and Triangle Fan a shape will be easy to make.

Triangle Strip

For instance a Triangle Strip is a set of connected triangles which share vertices.

Example of Triangle Strip

Using Triangle Strip we will be able to get the following output, using those given vertices.

enter image description here

Triangle Fan

Where a Triangle Fan is also a set of connected triangles, though all these triangles have a common vertex, which is the central vertex.

In OpenGL the central vertex is the first given vertex, in the Triangle Fan.

Example of Triangle Fan

Using Triangle Fan and the same vertices as in the other example, we will only be able to get the colored area as output. That is due to the importance of the arranged order of the vertices in Triangle Fan. Basically, all the vertices need to go around the central vertex.

enter image description here

Conclusion

As you can see on our 2 example sets of vertices those "output shapes" are unique to both Triangle Strip and Triangle Fan.

Extra

I made a similar answer here, you can read it if you want, I actually used the same images since the questions are closely related.