glRotate produces a rotation of angle degrees around the vector (𝐱, 𝐲, 𝐳). The current matrix (see glMatrixMode) is multiplied by a rotation matrix with the product replacing the current matrix, as if glMultMatrix were called with the following matrix as its argument:
Where 𝐜 = cos(angle), 𝐬 = sin(angle), and ∥(𝐱, 𝐲 ,𝐳)∥ = 1 (if not, the GL will normalize this vector).
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects drawn after glRotate is called are rotated. Use glPushMatrix and glPopMatrix to save and restore the unrotated coordinate system.
glRotate
produces a rotation of angle degrees around the vector (𝐱, 𝐲, 𝐳). The current matrix (see glMatrixMode) is multiplied by a rotation matrix with the product replacing the current matrix, as if glMultMatrix were called with the following matrix as its argument:⎛𝐱²(1 − 𝐜) + 𝐜ㅤㅤ𝐱𝐲(1 − 𝐜) − 𝐳𝐬ㅤㅤ𝐱𝐳(1 − 𝐜) + 𝐲𝐬ㅤㅤ0⎞
⎜𝐲𝐱(1 − 𝐜) + 𝐳𝐬ㅤㅤ𝐲²(1 − 𝐜) + 𝐜ㅤㅤ𝐲𝐳(1 − 𝐜) + 𝐱𝐬ㅤㅤ0 ⎜
⎜𝐱𝐳(1 − 𝐜) - 𝐲𝐬ㅤㅤ𝐲𝐳(1 − 𝐜) + 𝐱𝐬ㅤㅤ𝐳²(1 − 𝐜) + 𝐜ㅤ ㅤ0⎟
⎝ㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤ ㅤ 1⎠
Where 𝐜 = cos(angle), 𝐬 = sin(angle), and ∥(𝐱, 𝐲 ,𝐳)∥ = 1 (if not, the GL will normalize this vector).
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects drawn after
glRotate
is called are rotated. Use glPushMatrix and glPopMatrix to save and restore the unrotated coordinate system.