GL_TRIANGLE FAN Explanation

opengl

Solution

How does GL_TRIANGLE_FAN works exactly?

The first vertex of a triangle fan acts like a hub. The vertices following connect with the previous non-starting vertex and the hub.

Problem

I am trying to "fill" a surface of a sphere that I drew using this algorithm here: http://paulbourke.net/miscellaneous/sphere_cylinder/, the first method. I know that `GL_QUADS` is no longer used in OpenGL 3+. SO I used `GL_TRIANGLE_FAN`. Is it the same thing? The problem here is that my sphere facets are squares. So if I use `GL_TRIANGLE` then I get a weird "filling", not all the surface is covered. Am I doing it the wrong way? How does `GL_TRIANGLE_FAN` work exactly?

Original source

Related problems