How many vertices does a triangle fan use opengl

后端 未结 4 927
轮回少年
轮回少年 2021-01-03 01:44

I am learning openGL, and i have come across triangle fans using vertex buffer objects. If given an array of vertices to render, how does openGL decide how many of those ve

4条回答
  •  感情败类
    2021-01-03 02:32

    This can easily be explained by comparing Triangle Strips with Triangle Fans.

    Triangle Strip

    As you probably know, a Triangle Strip is a set connected triangles which share vertices, this allows for more efficient memory usage. (We save memory because we don't store all duplicated vertices)

    Example of a Triangle Strip

    enter image description here

    Triangle Fan

    On the other hand we have a Triangle Fan, this is also a set of connected triangles. Though all these triangles have one vertex in common, which is the central vertex. (The first vertex is always the center)

    With that said we can take the same image above and change the order of the vertices. When that done the Triangle Fan would look like this. (Where A, is the first and central vertex)

    Example of a Triangle Fan

    enter image description here

    In the image above the Triangle Fan will only work in the colored area, because of how the vertices need to be arranged according to be a Triangle Fan.

提交回复
热议问题