GL_TRIANGLE_STRIP和GL_TRIANGLE_FAN [英] GL_TRIANGLE_STRIP vs GL_TRIANGLE_FAN

查看:523
本文介绍了GL_TRIANGLE_STRIP和GL_TRIANGLE_FAN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

当知道 Triangle Strip Triangle Fan 之间的区别时,很容易制作形状.

三角带

例如 Triangle Strip 是一组共享顶点的连接三角形.

三角带示例

使用三角带,我们将能够使用给定的顶点获得以下输出.

三角扇

三角扇也是一组连接的三角形,尽管所有这些三角形都有一个共同的顶点,即中心顶点.

在OpenGL中,中心顶点是三角扇中的第一个给定顶点.

三角扇的例子

使用三角扇和与其他示例相同的顶点,我们将只能获得彩色区域作为输出.这是由于 Triangle Fan 中顶点排列顺序的重要性. 基本上,所有顶点都需要围绕中心顶点.

结论

在我们的两个示例顶点集上可以看到,这些输出形状"对于 Triangle Strip 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.

解决方案

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.

这篇关于GL_TRIANGLE_STRIP和GL_TRIANGLE_FAN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆