glTranslated, glTranslatef

[New - Windows 95, OEM Service Release 2]

The glTranslated and glTranslatef functions multiply the current matrix by a translation matrix.

void glTranslated(

    GLdouble x,

 

    GLdouble y,

 

    GLdouble z

 

   );

 

 

void glTranslatef(

    GLfloat x,

 

    GLfloat y,

 

    GLfloat z

 

   );

 

 

Parameters

x, y, z

The x, y, and z coordinates of a translation vector.

 

Remarks

The glTranslate function moves the coordinate system origin to the point specified by (x, y, z). The translation vector is used to compute a 4x4 translation matrix:

{bml bm62.BMP}

The current matrix (see glMatrixMode20CZ15) is multiplied by this translation matrix, with the product replacing the current matrix. That is, if M is the current matrix and T is the translation matrix, then M is replaced with M T.

If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects drawn after glTranslate is called are translated. Use glPushMatrix1MYNI2H and glPopMatrix to save and restore the untranslated coordinate system.

The following functions retrieve information related to glTranslated and glTranslatef:

glGet8KNKTW 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 are the error codes generated and their conditions.

Error Code

Condition

GL_INVALID_OPERATION

glTranslate was called between a call to glBegin and the corresponding call to glEnd.

 

See Also

glBegin, glEnd, glMatrixMode, glMultMatrix, glPushMatrix, glRotate, glScale