CPEN 461/661, Spring 1997
OpenGL Tutorial

  1. Changing the State
  2. As a geometric primitive is drawn, each of its vertices is affected by the current OpenGL "state" variables. These state variables specify information such as line width, line stipple pattern, color, shading method, fog, polygon culling, etc . . .

    Some state variables refer to OpenGL capabilities that are either "off" (set to the value GL_FALSE) or "on" (set to the value GL_TRUE). Other state variables refer to a certain mode (set to a value of type GLenum) chosen from a fixed set of modes. Lastly, there are state variables that are set to certain values (GLfloat, GLint, etc . . .).

    Each state variable has a default value. The values of the state variables, whether set by default or by the programmer, remain in effect until changed.

    The remainder of this section will cover some of the most commonly used state variables. Others will be covered in later sections. It is not within the scope of this tutorial to cover all of the state variables, so refer to other sources for additional information.

    The following example illustrates the some of effects of the above commands.

    Points_Lines.c Output



    Points_Lines.c Source Code