Monday, November 17, 2008

Why OpenGL a State Machine?

OpenGL is a state machine. You put it into various states (or modes) that then remain in effect until you change them. The current color for e.g. is a state variable. You can set the current color to white, red, or any other color, and thereafter every object is drawn with that color until you set the current color to something else.

The current color is only one of many state variables that OpenGL maintains. Others control such things as the current viewing and projection transformations, line and polygon stipple patterns, polygon drawing modes, pixel-packing conventions, positions and characteristics of lights, and material properties of the objects being drawn.

Many state variables refer to modes that are enabled or disabled with the command
glEnable() or glDisable().

It is because OpenGL is a state machine.

0 comments :

Post a Comment