CSc 433/533: OpenGL and GLUT Tutorial

  1. OpenGL Command Syntax
  2. OpenGL commands use the prefix gl and initial capital letters for each word making up the command name such as glBegin(). Similarly, OpenGL defined constants begin with GL_, use all capital letters, and use underscores to separate words such as GL_COLOR_BUFFER_BIT.

    Some OpenGL command names have a number and one, two, or three letters at the end to denote the number and type of parameters to the command. The first character indicates the number of values of the indicated type that must be presented to the command. The second character or character pair indicates the specific type of the arguments: 8-bit integer, 16-bit integer, 32-bit integer, single-precision floating-point, or double-precision floating-point. The final character, if present, is v, indicating that the command takes a pointer to an array (a vector) of values rather than a series of individual arguments.

    For example, in the command glVertex2i(), `2' is used to indicate three arguments and `i' is used to indicate that the arguments are integers. The letters and numbers used in the suffixes for the ANSI C implementation are shown below.

    Throughout this tutorial, OpenGL commands will be referred to by their base names only, and an asterisk will be included to indicate that there may be a suffix to the command name such as glColor*().

    A complete set of man pages for OpenGL commands is maintained by Sun Microsystems and can be found at http://www.sun.com/software/graphics/OpenGL/manpages. Some of the features described in these man pages are specific to Sun's implementation of OpenGL.