【发布时间】:2013-07-23 07:22:31
【问题描述】:
我是 OpenGL 的新手,想知道我们用矩阵做什么,如果有人可以用抽象直观的方式解释我,因为在阅读参考资料或任何教程时,所有这些都将矩阵作为已知机制。我学过数学矩阵,但由于英语不是我的母语,所以很难弄清楚一些东西是什么意思。
我在 www.learnopengl.com 找到了很好的例子:
The model matrix. This matrix is used to place a model somewhere in the “world”. For example, if you have a model of a car and you want it located 1000 meters to the east, you will use the model matrix to do this.
The view matrix. This matrix represents the camera. If we want to view our car which is 1000 meters to the east, we’ll have to move ourselves 1000 meters to the east as well (another way of thinking about it is that we remain stationary, and the rest of the world moves 1000 meters to the west). We use the view matrix to do this.
The projection matrix. Since our screens are flat, we need to do a final transformation to “project” our view onto our screen and get that nice 3D perspective. This is what the projection matrix is used for.
这很好地解释了它。但是,我们如何构建它们?它们有多大?
另外,我读过这个问题: What does glLoadIdentity() do in OpenGL?
那个:
glMatrixMode(GL_PROJECTION) 处理使用的矩阵 透视变换或正交变换。
glMatrixMode(GL_MODELVIEW) 处理模型视图使用的矩阵 转型。也就是说,将您的对象(又名模型)转换为 查看坐标空间(或相机空间)。
这些转换意味着什么以及如何计算它们?
我知道这里有很多问题,但我正在尝试更好地了解所有这些问题,以便更好地了解 OpenGL。这就是为什么我需要一些抽象的解释来深入了解所有细节并理解超越的概念。
【问题讨论】:
-
它们用于操作顶点、平移、旋转和缩放。如果您想了解更多信息,请阅读矩阵代数。
-
您的问题有点像在问“为什么我需要学习物理学来制造可以按照我的意愿飞行的火箭”。有时你只需要研究和学习一些东西。 (PS:我不是那个否决这个问题的人)
-
没关系,我不是为了名声而来。我真正需要的是像 jh314 这样的人,只需要讲两句关于 glMatrixMode 的句子,这会让整个事情变得容易理解。连接 OpenGL 概念的小片段。
-
这是一种很好的态度——我曾经问过这些模式的目的是什么,我会把你链接到这个问题,有些人提供了很好的答案。
-
@EdwardBird 谢谢 :)