Hello quew8,
Thanks for your answer. This may sounds strange but I think I got what Quaternions are and I have my own class too. But even if I know what they are I dont know how to use them.
Quaternions are a 4d representation of a rotation, where the last item (w or teta) can be used to calculate a interpolation between two angles, so if I have the vector 0,1,0 and I want to rotate it over 45 degress on Z axis (0,0,1) I just create a quaternion from Axis 0,0,1 using teta as 45 and multiplicate it by a quaternion 0,1,0 with teta 0. This will result in a quaternion intersection between 0,1,0 and 0,0,1 with 45 of degress.
If I understood right, I can use Quaternions to handle my axis rotations. But what I didnt understood is how to use them. Should I store 3 quaternions with X, Y and Z rotation and them multiplicate all them together ((Z * Y) * X) and transform the result into a Matrix4f, multiplicate with my Translation matrix and send to my shader?
Note: Dont know if this matters, but my viewMatrix goes directly to shader and its multiplicated there:
#version 430
layout(location = 0)in vec4 vertex;
layout(location = 1)in vec4 fragmentColor;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
out vec4 fragColor;
void main() {
fragColor = fragmentColor;
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vertex;
}
Anyway, When I got home I'll try to use a Matrix4f for pitch, one for yaw, one for roll and one for translation like you said. After that I'll post the results here.
Thanks again for your help.