OpenGL State variables
property values and other parameter settings are specified by independent functions that define the current OpenGL state. The state variables in OpenGL are color and other primitive attributes, current matrix patterns, elements of the Model watch matrix, cache current position and scene lighting effect parameters, and so on. All OpenGL parameters have default values that remain unchanged and work before the new value is specified. At any time we can query the current value of the state parameter of the system. The property settings for the output entities are discussed in the later sections of this chapter, with additional parameters being covered in the next few chapters.
All OpenGL primitives are displayed using the properties in the current state table. Changing one or several property settings can only affect those entities that are specified after the OpenGL state has changed. Therefore, we can display a green segment first, then change the current color to red, and then define another segment. This lets you display green and red line segments together. Similarly, some OpenGL state values can be specified in the Glbegin/g1end function with intermediate and coordinate values, so that the parameter settings can vary depending on the coordinate position.
Computer Graphics (iii) _ Elements of attributes _1_opengl state variables