OpenGL C Quick Reference

Modeling Transformations

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

Computes a matrix that performs a counterclockwise rotation about the specified vector from the origin through the point (x, y, z).


void glScalef( GLfloat scalex, GLfloat scaley, GLfloat 
scalez )
void glScaled( GLdouble scalex, GLdouble scaley, GLdouble 
scalez )

Scales the coordinate system along the x, y and z axes.


void glTranslatef( GLfloat transx, GLfloat transy, GLfloat 
transz )
void glTranslated( GLdouble transx, GLdouble transy, 
GLdouble transz )

Moves the coordinate system origin to the point specified by (x,y,z)


Projection Transformations

void glOrtho( GLdouble left, GLdouble right, GLdouble
bottom, GLdouble top, GLdouble near, GLdouble far )

Multiplies the current matrix by a matrix that describes a parallel projection.


void gluOrtho2D( GLdouble left, GLdouble right, GLdouble 
bottom, GLdouble top )

Multiplies the current matrix by a matrix that describes a two-dimensional parallel projection. This is equivalent to calling glOrtho with near=-1 and far=1.


void glFrustum( GLdouble left, GLdouble right, GLdouble 
bottom, GLdouble top, GLdouble near, GLdouble far )

Multiplies the current matrix by a matrix that describes a perspective projection.


void gluPerspective( GLdouble fovy, GLdouble aspect, 
GLdouble near, GLdouble far )

Multiplies the current matrix by a matrix that describes a perspective projection, with a symmetrical, pyramid-shaped viewing volume.


Matrix Stack Manipulation

void glMatrixMode( GLenum mode )

Specifies which matrix stack is the target for subsequent matrix operations.


void glPushMatrix( GLvoid )
void glPopMatrix( GLvoid )

glPushMatrix() pushes the current matrix stack down by one, duplicating the current matrix. glPopMatrix() pops the current matrix stack, replacing the current matrix with the one below it on the stack.


void glLoadIdentity( void );

Replaces the current matrix with the identity matrix.


void glLoadMatrixf( const GLfloat *m )
void glLoadMatrixd( const GLdouble *m )

Replaces the current matrix (as specified by the current matrix mode).


void glGetFloatv( GL_PROJECTION_MATRIX, GLfloat *m )
void glGetFloatv( GL_MODELVIEW_MATRIX, GLfloat *m )

Returns the matrix on the top of the specified matrix stack.


void glMultMatrixf( const GLfloat *m )
void glMultMatrixd( const GLdouble *m )

Multiplies the current matrix (as specified by the current matrix mode) with the one specified in m.