next up previous
Next: Initializations: Up: OpenGL Quick Reference Guide Previous: OpenGL Quick Reference Guide

Basic Information:

Before reading the following sections, here are some general pieces of information which you should be aware of.

Generic Function Naming:
Many OpenGL procedures come in a variety of forms, depending on the argument types. For example, glVertex3f() takes 3 float arguments, glVertex4d() takes 4 double arguments, and glVertex3iv() takes a single pointer to an array of 3 int's. The naming conventions are quite regular. These procedures are lumped under the single name glVertex*() in the descriptions below. See the reference manual for the actual calling sequences.

GL Data Types:
OpenGL defines a number of data types. Most of these translate directly to types in C or C++. For example, GLdouble is the same as double, and GLuint is an unsigned int. The type GLClampf is a float that has been "clamped" to the interval [0,1], meaning that values less than 0 are set to 0 and values greater than 1 are set to 1. See the file Mesa/include/GL/gl.h for exact type definitions.

OpenGL colors are typically defined using RGB (red, green, blue) components and a special A (or alpha) component The A component has varying interpretations depending on context (typically in providing for transparency and color blending). When no special effects are desired, set A = 1.

Error Messages:
OpenGL and Mesa are "quiet" about errors. When an error has been committed, the system does not display any error message. Rather it sets an error code, which the user can query through glGetError(). It is the programmer's responsibility to check the error code after each call to an OpenGL procedure. If you are using Mesa (WAM and Glue), you can set the environment variable MESA_DEBUG. This will cause Mesa to output a message whenever an error is detected (and produces a few annoying warning messages that you may not care about). This can be done by adding the command "setenv MESA_DEBUG" to your login initialization file.

By the way, Mesa always outputs a message about how many colors from the colormap it was able to allocate. For best results, kill any other colormap hogs (like netscape and xv) before running any Mesa program.

Please report any errors or send comments to Dave Mount

Last updated: Sat, Feb 8, 2003.