Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GL_TRIANGLE FAN Explanation

Tags:

opengl

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?

like image 591
Trt Trt Avatar asked Nov 07 '11 23:11

Trt Trt


People also ask

How does a triangle fan work?

A triangle fan is a primitive in 3D computer graphics that saves on storage and processing time. It describes a set of connected triangles that share one central vertex (unlike the triangle strip that connects the next vertex point to the last two used vertices to form a triangle), possibly within a triangle mesh.

How do you use the GL triangle strip?

To draw a triangle strip using immediate mode OpenGL, glBegin() must be passed the argument GL_TRIANGLE_STRIP , which notifies OpenGL a triangle strip is about to be drawn. The glVertex*() family of functions specify the coordinates for each vertex in the triangle strip.

What is Gl_triangles?

GL_TRIANGLES. Treats each triplet of vertices as an independent triangle. Vertices 3n - 2, 3n - 1, and 3n define triangle n. N/3 triangles are drawn.


1 Answers

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.

enter image description here

like image 56
datenwolf Avatar answered Sep 30 '22 19:09

datenwolf