glRotated, glRotatef

The glRotated and glRotatef functions multiply the current matrix by a rotation matrix.

void glRotated(
  GLdouble angle,  GLdouble x,  GLdouble y,  GLdouble z);void glRotatef(  GLfloat angle,  GLfloat x,  GLfloat y,  GLfloat z);

Parameters

  • angle
    The angle of rotation, in degrees.
  • x, y, z
    The x, y, and z coordinates of a vector, respectively.

Remarks

The glRotate function computes a matrix that performs a counterclockwise rotation of angle degrees about the vector from the origin through the point (x, y, z).

The current matrix (see glMatrixMode) is multiplied by this rotation matrix, with the product replacing the current matrix. That is, if M is the current matrix and R is the translation matrix, then M is replaced with M•R.

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.

The following functions retrieve information related to glRotate:

glGet with argument GL_RENDER_MODE

glGet with argument GL_MATRIX_MODE

glGet with argument GL_MODELVIEW_MATRIX

glGet with argument GL_PROJECTION_MATRIX

glGet with argument GL_TEXTURE_MATRIX

Error Codes

The following is the error code and its condition.

Error code Condition
GL_INVALID_OPERATION glRotate was called between a call to glBegin and the corresponding call to glEnd.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 or later.
**  Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
**  Header:** Declared in Gl.h.
**  Library:** Use Opengl32.lib.

See Also

glBegin, glEnd, glMatrixMode, glMultMatrix, glPushMatrix, glScale, glTranslate