I am trying implement arcball/trackball rotation but I have a problem with the center of rotation. I want the center to be the center of my screen no matter what.
Let me explain what I have done so far.
I've created a quaterion (rotation axis: vector_start x vector_end, angle: vector_start * vector_end)
From that quaternion I've created a rotation matrix in order to use it with glMultMatrixf(matrix) and get the desired rotation.
The problem is that while my model seems to arcball rotate as it should it always rotates around its local origin. How could I make it rotate around the center of my screen no matter where its local origin is located?
I suppose a solution to that problem could be to translate the whole rotation axis in the center of the screen and then apply the rotation but is this possible? Do I miss something here?
You should be able to solve this by applying rotation and translation matrices in the correct order. In your code you could translate back to the origin T(-pos_x, -pos_y, -pos_z), apply your rotation, and translate to the object center again T(pos_x, pos_y, pos_z). This should work in general, independent of how your rotation matrix is constructed.