1
\$\begingroup\$
cube
 [[ 1.  0.  0. 6.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]

view
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 1. 0.]
 [0. 0. 0. 1.]]

final
[[ 1.  0.  0. 6.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]

Hello! I have a cube and I'm trying to move it around. The above are the calculated matricies for the cube, viewport, and the combined matrix after multiplication. The result is this:

enter image description here

I'm not sure why it's being warped like this instead of scooting over a bit. Any idea?

\$\endgroup\$
2
\$\begingroup\$

Your matrix is row major, so you should transpose it in order to get behaviour you expect, since OpenGL memory layout is more column-major friendly, because translation is located in the memory at the fourth vector of the 4x4 matrix.

\$\endgroup\$
  • \$\begingroup\$ You're a legend, can't believe I didn't think to try that. \$\endgroup\$ – Alex Weavers Jul 5 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.