[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

mmode Subroutine


Sets the current matrix mode.


Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void mmode(Int16 mode)


INTEGER*4 mode
Note: For FORTRAN users, this subroutine accepts long integer parameters (INTEGER*4) when started from a FORTRAN program, although it accepts short integers when started from a C program. The C and FORTRAN syntax shown here reflect this difference.


The mmode subroutine sets the current matrix mode.

The system is in single matrix mode after a call to the winopen, ginit, or gbegin subroutines. This mode is sufficient except for lighting calculations; when performing those, use viewing matrix mode.

Because the projection matrix is not stored on the matrix stack, the projection matrix is not normally accessible. However, if you want to define your own projection matrix, put the system into projection matrix mode. You can then use the standard matrix manipulation commands to alter the projection matrix. When you are in projection matrix mode, do not use the pushmatrix and popmatrix subroutines.

When you have finished modifying the projection matrix, return to viewing matrix mode and load a 4 by 4 identity matrix onto the matrix stack. (The standard transformation subroutines, rotate, rot, translate, scale, lookat, and polarview, all use matrix multiplication. Loading the identity matrix onto the matrix stack is a safe way to make sure that there is a matrix by which to multiply.)


mode Specifies the current matrix mode to be set.
There are three possible values for this function:
MSINGLE MSINGL Single matrix
MPROJECTION MPROJE Projection matrix
MVIEWING MVIEWI Viewing matrix


The example C language program cylinder1.c uses the mmode subroutine, with MVIEWING as the value of the mode parameter, to specify that matrix operations manipulate only the modeling and viewing matrix (not the projection matrix).

Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.


/usr/include/gl/gl.h Contains C language constant and variable type definitions for GL.
/usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

Related Information

Making a new material, light, or lighting model definition active with the lmbind subroutine.

Defining a new material, light, or lighting model with the lmdef subroutine.

AIX Graphics Library Overview, Creating Lighting Effects, Setting Pipeline Options, and Working in Color Map and RGB Modes.

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