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:
rotate(200*(i+1), 'z');
to:
glRotate(.1*(200*(i+1), 0.0, 0.0, 1.0);
When translating from rotate to glRotate you switch to degrees from tenths of degrees and replace 'z' with a vector for the z-axis.
polarview(distance, azimuth, incidence, twist);
to:
glTranslatef( 0.0, 0.0, -distance);
glRotatef( -twist * 10.0, 0.0, 0.0, 1.0);
glRotatef( -incidence * 10.0, 1.0, 0.0, 0.0);
glRotatef( -azimuth * 10.0, 0.0, 0.0, 1.0);
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, | Replace current matrix with the specified matrix. |
multmatrix | glMultMatrixf, | 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, | 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, | Multiply current matrix by a scaling matrix. |
translate | glTranslatef, | 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 |