I am studying an OpenGL programming program and I am stuck on how to implement it, so the camera follows the mouse pointer. As in the fps game, you want to see where your mouse has pointed, but I can’t find a good solution for this while I am moving. I thought about saving one matrix for movement, for example, walking and shooting, using quaternions to handle rotation. Then turn the quaternion into a rotation matrix, load the identifier for the model representation matrix and draw this matrix from both matrices.
Of course, there are some problems with this, for example, which matrix should we use in the first multiplication, and the code will be ugly.
So, I am wondering if anyone has a good solution to solve this issue, so I do not need to figure out which matrix to use in the first place, and what gives a cleaner code.
source
share