GL_QUADS 有什么不好呢?

发布于 2024-11-19 12:05:33 字数 189 浏览 1 评论 0原文

我听说 GL_QUADS 将在 OpenGL 版本中删除 > 3.0,这是为什么?那我的旧程序以后就不能用了吗?我进行了基准测试,GL_TRIANGLESGL_QUADS 在渲染速度上没有差异(甚至可能 GL_QUADS 更快)。那么有什么意义呢?

I hear that GL_QUADS are going to be removed in the OpenGL versions > 3.0, why is that? Will my old programs not work in the future then? I have benchmarked, and GL_TRIANGLES or GL_QUADS have no difference in render speed (might even be that GL_QUADS is faster). So whats the point?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

樱花坊 2024-11-26 12:05:33

关键是你的 GPU 渲染的是三角形,而不是四边形。从两个三角形构造一个矩形非常简单,因此 API 并不需要承受原生渲染四边形的能力。 OpenGL 正在经历一次重大的调整过程,削减了许多 15 年前有意义的功能,但不再符合 GPU 的工作方式,或者 GPU 未来的工作方式。我相信,固定功能管道也从最新版本中消失了,因为它不再是必要的,而且它不再与 GPU 的工作方式(可编程着色器)相匹配。

关键是,OpenGL API 越小、越紧,供应商就越容易编写健壮、高性能的驱动程序,也就越容易学会正确有效地使用 API。

几年前,实际上 OpenGL 中的任何事情都可以通过 3-5 种不同的方式来完成,这给开发人员带来了很大的负担,因为如果您想要获得最佳性能,就必须弄清楚哪种实现是正确的。

因此他们正在尝试简化 API。

The point is that your GPU renders triangles, not quads. And it is pretty much trivial to construct a rectangle from two triangles, so the API doesn't really need to be burdened with the ability to render quads natively. OpenGL is going through a major trimming process, cutting a lot of functionality that made sense 15 years ago, but no longer match how the GPU works, or how the GPU is ever going to work. The fixed function pipeline is gone from the latest versions too, I believe, because, once again, it's no longer necessary, and it no longer matches how the GPU works (programmable shaders).

The point is that the smaller and tighter the OpenGL API can be made, the easier it is for vendors to write robust, high-performance drivers, and the easier it is to learn to use the API correctly and efficiently.

A few years ago, practically anything in OpenGL could be done in 3-5 different ways, which put a lot of burden on the developer to figure out which implementation is the right one if you want optimal performance.

So they're trying to streamline the API.

笑脸一如从前 2024-11-26 12:05:33

对于你的问题,人们已经回答得很好了。除了他们的答案之外,GL_QUADS 被弃用的原因之一是四边形的未定义性质。

例如,尝试用点 (0,0,0), (1,0,0), (1,1,1), (0,1,0) 建模一个二维正方形。这是一个平坦的四边形,一个角被拉起。用这种方法不可能画出一个普通的平面正方形。根据驱动程序的不同,它会以一种或另一种方式分成 2 个三角形 - 这是我们无法控制的。这样的模型必须用两个三角形来建模。 - 三角形的所有三点始终位于同一平面上。

People have already answered quite well on your question. On top of their answer, one of the reason that GL_QUADS being deprecated is because of quads's undefined nature.

For example try to model a 2d square with points (0,0,0), (1,0,0), (1,1,1), (0,1,0). This is flat quad with one corner dragged up. It is impossible to draw a NORMAL flat square in such way. Depending on drivers, it will be split to 2 triangles either one or another way - which we can't control. Such a model MUST be modeled with two triangles. - All three points of a triangle always lies on a same plane.

蓝咒 2024-11-26 12:05:33

它不会“会”成为任何东西。与许多其他功能一样,GL_QUADS 在 3.0 版中已弃用,并在 3.1 版中删除。显然,如果您创建兼容性上下文,这一切都是无关紧要的。

任何人可能给出的反对它们的任何答案都纯粹是猜测。

It isn't "going" to be anything. As with a lot of other functionality, GL_QUADS was deprecated in version 3.0 and removed in version 3.1. Obviously this is all irrelevant if you create a compatibility context.

Any answer that anyone might give for the reason for deprecating them would be sheer speculation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文