OpenGL as a State Machine
  • (Graphic of OGL State Machine)
  •  Code sets state variables of the state machine (current color for example)
  •  States stay in effect until they are changed
  •  Examples of State Variables
    • Viewing/Projection Matricies
    • Line/Polygon stipple patterns
    • Pixel packing conventions
    • Lighting specification
    • Material specification

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

OpenGL State Variables
  • Most state variables are set by glEnable() or glDisable()

  • Example:  glEnable(GL_BLEND);
  •  Each State variable has a default value
  •  Current values may be queried by the following methods:

  •  glGetBooleanv()
     glGetDoublev()
     glGetFloatv()
     glGetIntegerv()
     glGetPointerv()
     glIsEnabled()
  •  Choose the appropriate query depending on the desired return value
  • A collection of state variables can be saved on the attribute stack with glPushAttrib()
  • Attributes can be restored by glPopAttrib()

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

The Rendering Pipeline
  • Most OpenGL implementations have a series of processing stages known as the rendering pipeline
  •  This pipeline is not required, but serves as a way to characterize the functions of OGL.  (Most hardware implementations have this type of pipeline)
  •  (Figure 1-2)
  •   Note that pixel and vertex data travel down separate paths until the rasterization phase

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Display Lists
  • Figure 1-2 w/DL section highlighted
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Evaluators
  • Figure 1-2 w/Evaluator section highlighted
  •  
  •  
  •  
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Per-vertex operations
     
  • Figure 1-2 w/Per-vertex section highlighted
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Primitive Assembly
     
  • Figure 1-2 w/Primitive Assembly section highlighted
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Pixel Operations
     
  • Figure 1-2 w/Pixel operations section highlighted
  •  
  •  
  •  Example OGL calls ..
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Texture Assembly
     
  • Figure 1-2 w/Tex Assembly section highlighted
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

Rasterization
     
  • Figure 1-2 w/Rasterization section highlighted
  •  
  •  
  •  
  •  Rasterization is the process of converting geometric primitives into fragments, or pixels
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •