Porting Matrix and Transformation Functions

IRIS GL and OpenGL handle matrices and transformations in a similar manner. But there are several differences to keep in mind when porting code from IRIS GL:

The following table lists the OpenGL matrix functions and their equivalent IRIS GL functions.

IRIS GL Function OpenGL Function Meaning
mmode glMatrixMode Set current matrix mode.
glLoadIdentity Replace current matrix with the identity matrix.
loadmatrix glLoadMatrixf,

glLoadMatrixd

Replace current matrix with the specified matrix.
multmatrix glMultMatrixf,

glMultMatrixd

Post-multiply current matrix with the specified matrix (note that multmatrix pre-multiplied).
mapw, mapw2 gluUnProject Project world-space coordinates to object space (see also gluProject).
ortho glOrtho Multiply current matrix by an orthographic projection matrix.
ortho2 gluOrtho2D Define a two-dimensional orthographic projection matrix.
perspective gluPerspective Define a perspective projection matrix.
picksize gluPickMatrix Define a picking region.
popmatrix glPopMatrix Pop current matrix stack, replacing the current matrix with the one below it.
pushmatrix glPushMatrix Push current matrix stack down by one, duplicating the current matrix.
rotate,

rot

glRotated,

glRotatef

Rotate current coordinate system by the given angle about the vector from the origin through the given point. Note that rotate rotated only about the x-, y-, and z-axes.
scale glScaled,

glScalef

Multiply current matrix by a scaling matrix.
translate glTranslatef,

glTranslated

Move coordinate-system origin to the point specified, by multiplying the current matrix by a translation matrix.
window glFrustum Given coordinates for clipping planes, multiply the current matrix by a perspective matrix.

OpenGL has three matrix modes, which are set with glMatrixMode. The following table lists the modes available as parameters for glMatrixMode.

IRIS GL Matrix Mode OpenGL Mode Meaning Min Stack Depth
MTEXTURE GL_TEXTURE Operate on the texture matrix stack. 2
MVIEWING GL_MODELVIEW Operate on the model view matrix stack. 32
MPROJECTION GL_PROJECTION Operate on the projection matrix stack. 2