Hello,

I guess a lot of you people know about the awesome GLM math library. I’ve a question about the matrix to quaternion conversion. I tried out several “tutorials” and code snippets from the net for matrix to quaternion conversion. There’s is a different between the signs of the quaterion created by GLM and by the tutorials / code snippets. The numbers it self are equal. But when I transpose the matrix and did the conversion again, the quaternion created by the code from the net delivered exactly the same results like the GLM (correct signs and numbers).

Although GLM is mostely used for GLM it uses a row major alignment for the matrices and not the column major used by opengl. Of course you can change that with GLM but the default setting is row major.

When I had a look at the GLM conversion code I saw some differences in the calculation

internet code snippet

```
qw = 0.25 * S;
qx = (m21 - m12) / S;
qy = (m02 - m20) / S;
qz = (m10 - m01) / S;
```

…and in GLM it looks like

```
qw = 0.25 * S;
qx = (m12 - m21) / S;
qy = (m20 - m02) / S;
qz = (m01 - m10) / S;
```

What is the correct way for OpenGL that uses the right handed coordinate system ?

regards,

lobbel