gberes
gberes

Reputation: 1169

opengl rotate by quaternion

I implemented my quaternion class like this. I can convert the quaternion to 3x3 rotation matrix, but then how should i apply that to my modelview matrix?

Upvotes: 0

Views: 283

Answers (1)

Oleg Titov
Oleg Titov

Reputation: 1140

glMultMatrixf(GLfloat*) and glMultMatrixd(GLdouble*) do exactly what you need. The only thing is to convert 3x3 matrix (O) to 4x4 matrix (O') by adding some 0 and 1:

     |       0|
O' = |   O   0|
     |       0|
     | 0 0 0 1|

Note that openGL stores matrices in column-major order (like in Fortran).

Upvotes: 1

Related Questions