How can I calculate my own viewing matrix?
The question is: the matrix stores rotation, translation, scale, … . But the transforms are not commutative - that is, the result is not the same from rotate then translate or on the contrary. That is, if i simply fill the 4*4 matrix with rot. & trans. - result - will be wrong. Is there a symply way to imagine what the entire matrix, but not any part of it will do?
You can think of your end-transform matrix as a connection of several transformations like rotation, scaling and translation. They are combined via a matrix multiplication.
If you want to do this
- Rotate
- Scale
- Translate
You’ll have to multiply the matrix in this conter-order:
- Multiply Translation with Scale
- Multiply result with Rotation
If you want you tranform to be apllied to a camera view, you’ll have to use the transpose of the transform matrix of the camera.
There’s quite an interresting discussion about that stuff on this board. Topic is glMultMatrix if I remember correctly.