我是 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.
这很好地解释了它。但是,我们如何构建它们?它们有多大?
另外,我读过这个问题: glLoadIdentity() 在 OpenGL 中做了什么?
那:
glMatrixMode(GL_PROJECTION) 处理透视变换或正交变换使用的矩阵。
glMatrixMode(GL_MODELVIEW) 处理模型视图转换使用的矩阵。也就是说,将您的对象(又名模型)转换为视图坐标空间(或相机空间)。
这些转换意味着什么以及如何计算它们?
我知道这里有很多问题,但我试图更好地理解所有这些问题,以便更好地了解 OpenGL。这就是为什么我需要一些抽象的解释来深入了解所有细节并理解超越的概念。