To main page | 3dengine.org

# Right, Up, Back vectors From Modelview matrix

The modelview matrix actually contains 4 vectors: In this text m[i] is i-th element of modelview matrix as returned by glGetFloat call.

The "Right vector" is ( m, m, m ).
The "Up vector" is ( m, m, m ).
The "Back vector" is ( m, m, m ).

RUB is a mnemonic to easily remember order in which vectors are stored in modelview matrix.

Length of each of those vectors equals 1.0 always and the angle between any of them is 90 degrees - they are unit vector and the 3x3 matrix formed by R-U-B-vectors is called rotation matrix.

## Camera center

The "encoded" camera center is m,m,m. The "encoded" part is due to the fact that this is NOT world coordinates, but the coordinates in terms of "right-up-back vectors", (it's the position of world origin in this camera's coordinate frame), so to find the real position you have to do some calculations: -R*t, where R is [0 4 8; 1 5 9; 2 6 10] matrix and t is [12 13 14] column vector.

See Center of viewport's "3D coordinates of current camera center in PyOpenGL" section to find out how to "decode" it.