3 out of 4 rated this helpful - Rate this topic

glTranslatef function

Applies to: desktop apps only

The glTranslatef function multiplies the current matrix by a translation matrix.

Syntax

void WINAPI glTranslatef(
  GLfloat x,
  GLfloat y,
  GLfloat z
);

Parameters

x

The x coordinate of a translation vector.

y

The y coordinate of a translation vector.

z

The z coordinate of a translation vector.

Return value

This function does not return a value.

Remarks

The glTranslatef function produces the translation specified by (x, y, z). The translation vector is used to compute a 4x4 translation matrix:

Ee872066.trans01(en-us,VS.85).png

The current matrix (see glMatrixMode) 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 glTranslatef is called are translated. Use glPushMatrix and glPopMatrix to save and restore the untranslated coordinate system.

The following functions retrieve information related to glTranslated and glTranslatef:

glGet with argument GL_MATRIX_MODE

glGet with argument GL_MODELVIEW_MATRIX

glGet with argument GL_PROJECTION_MATRIX

glGet with argument GL_TEXTURE_MATRIX

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Gl.h

Library

Opengl32.lib

DLL

Opengl32.dll

See also

glBegin
glEnd
glMatrixMode
glMultMatrix
glPushMatrix
glRotate
glScale

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
© 2013 Microsoft. All rights reserved.