I've been trying to rotate an object using the functions of the class QQuaternion
.
I defined my quaternion then normalize it. Now I'm struggling to make it rotate using this specific function :
void QMatrix4x4::rotate(const QQuaternion &quaternion)
So this function multiplies a current matrix (this matrix) with the rotation matrix that corresponds to the quaternion I defined. In my code, the current matrix is the modelview matrix.
So logically, I should type m.rotate(quaternion) but how can I specify that m is actually the modelview matrix ?
here is what I tried to do:
GLfloat matrix[16];
glGetFloatv (GL_MODELVIEW_MATRIX, matrix);
matrix.rotate(quaternion);
I think now the function knows that matrix is actually the modelview matrix.
But, I got an error: member reference base type GLfloat [16]
is not a structure or union. So I don't think it's the right way to do it.