简体   繁体   中英

GL_TRIANGLE_STRIP vs GL_TRIANGLE_FAN

我需要一个只能由GL_TRIANGLE_STRIP完成的多边形和另一个只能由GL_TRIANGLE_FAN完成的多边形的GL_TRIANGLE_FAN

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.

在此处输入图片说明

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.

在此处输入图片说明

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.

Difficult to answer in pure text. For Fan, an S shape would be impossible (in general, remember that fan is limited in that there is a point common to every triangle).

As for the other way around - it's a trick question. triangle_strip can do every triangle_fan polygon, although it requires a little trickery. Consider the following polygon (ordering shown is for triangle_fan)

3--4--5
|\ | /|
2--1--6
   | \|
   8--7

This could be done as follows

2-----4
| \  /|
1--3/7| 
   | \|
   6--5

Note the overlapping polygons. If you don't allow double-sided polys or overlap, then this would be an example of a fan only poly, I suppose.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM