Why does my translation matrix needs to be transposed?

前端 未结 2 1544
闹比i
闹比i 2020-12-15 17:15

I\'m working on a small graphics engine using OpenGL and I\'m having some issues with my translation matrix. I\'m using OpenGL 3.3, GLSL and C++. The situation is this: I ha

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 17:58

    For OpenGL

    1, 0, 0, 0
    0, 1, 0, 0
    0, 0, 1, 0
    x, y, z, 1
    

    Is the correct Translation Matrix. Why? Opengl Uses column-major matrix ordering. Which is the Transpose of the Matrix you initially presented, which is in row-major ordering. Row major is used in most math text-books and also DirectX, so it is a common point of confusion for those new to OpenGL.

    See: http://www.mindcontrol.org/~hplus/graphics/matrix-layout.html

提交回复
热议问题