Hi,

I’m new to OpenGL and quaternions, but after doing some tutorials from opengl-tutorial, I’m trying to do the MVP with quats.

With the MVP I get the expected rotated triangle. But with quats I get a different rotation (I would link to an image, but seems I can’t).

This is what I have in my C++ loop:

```
// Send our transformation to the currently bound shader,
// in the "MVP" uniform
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
// Let's try the same Matrix in Quat
glm::quat qModel = glm::gtx::quaternion::toQuat(MVP);
glm::gtc::quaternion::normalize(qModel);
glUniform4f(qModelID, qModel.x, qModel.y, qModel.z, qModel.w);
```

This is what I have in the shader:

```
// Values that stay constant for the whole mesh.
uniform mat4 MVP;
uniform vec4 qModel;
//rotate vector, taken from kri engine
vec3 qrot(vec4 q, vec3 v) {
return v + 2.0*cross(q.xyz, cross(q.xyz,v) + q.w*v);
}
void main(){
// Output position of the vertex, in clip space : MVP * position
//gl_Position = MVP * vec4(vertexPosition_modelspace, 1);
gl_Position = vec4(qrot(qModel, vertexPosition_modelspace),1);
}
```

Like you can see, for now, I just want to converted the MVP matrix to a Quat and use it in the shader, but I’m messing something up.

Any help would be appreciated.

Many thanks.