[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glTranslate Subroutine

Purpose

Multiplies the current matrix by a translation matrix.

Library

OpenGL C bindings library: libGL.a

C Syntax

void glTranslated(GLdouble X, 
   GLdouble Y,
   GLdouble Z)
void glTranslatef(GLfloat X, 
   GLfloat Y,
   GLfloat Z)

Parameters

X, Y, Z Specify the X, Y, and Z coordinates of a translation vector.

Description

The glTranslate subroutine moves the coordinate system origin to the point specified by (X,Y,Z). The translation vector is used to compute a 4 x 4 translation matrix as follows:

The current matrix (see the glMatrixMode subroutine for information on specifying the current matrix) 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, M is replaced with MT.

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

Errors

GL_INVALID_OPERATION The glTranslate subroutine is called between a call to glBegin and the corresponding call to glEnd.

Associated Gets

Associated gets for the glTranslate subroutine are as follows. (See the glGet subroutine for more information.)

glGet with argument GL_MATRIX_MODE

glGet with argument GL_MODELVIEW_MATRIX

glGet with argument GL_PROJECTION_MATRIX

glGet with argument GL_TEXTURE_MATRIX.

Files

/usr/include/GL/gl.h Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glBegin or glEnd subroutine, glMatrixMode subroutine, glMultMatrix subroutine, glPushMatrix subroutine, glRotate subroutine, glScale subroutine.

OpenGL Overview.


[ Previous | Next | Contents | Glossary | Home | Search ]