I am trying to understand and apply modern OpenGL matrix transformations. I already read a lot of different sources but I am not sure what I am actually doing wrong.
First I'll quote a comment to the OpenTK issue: Problem with matrices #687:
Because of how matrices are treated in C# and OpenTK, multiplication order is inverted from what you might expect in C/C++ and GLSL. This is an old artefact in the library, and it's too late to change now, unfortunately.
In compare to glsl, where column major order matrices have to be multiplied form the right to the left, where the right matrix is the matrix which is applied "first", in OpenTK the matrices have to be multiplied from the left to the right.
This means, if you want to calculate the viewProjectionMatrix
in glsl, which does the view transformation followed by the projection, then in glsl it is (for column major order matrices):
mat4 viewProjectionMatrix = projectionMatrix * viewMatrix;
If you want to do the same in in OpenTK, by the use of Matrix4, then you've to do:
_viewProjectionMatrix = _viewMatrix * _projectionMatrix;