Your function GLRotation()
specifies the angle in radians to rotate in each principle axis. On the other hand glm::rotate(angle, axis)
specifies a rotation about a provided axis. So, strictly speaking you can define your GLRotation
as follows:
inline mat4
GLRotation(float x, float y, float z)
{
return
glm::rotate(x, 1, 0, 0) *
glm::rotate(y, 0, 1, 0) *
glm::rotate(z, 0, 0, 1);
}
Although I wouldn't advise this, because describing rotations in this way can lead to Gimbal lock (when you rotate in one axis in such a way that it becomes aligned with another axis, losing you one degree of freedom).
Better to look into Axis-Angle representations of rotations, which is what glm::rotate
uses. They aren't susceptible to gimbal lock, and can represent any 3D rotation about an axis through the origin.