Research archive

OpenGL Design tradeoffs and notes

Historical research material converted from the original PmWiki site.

Research archive · original page Research.OpenGLSummary · last recorded update 2012-09-06

  1. To enable the pipeline to process objects independently, various objects' lighting are not allowed to interact. Therefore `OpenGL cannot directly do raytracing and radiosity, altho those are more realistic. For a nice raytracing package, see http://www.povray.org .
  2. Separate the object definition from the viewing from the lighting.
  3. Graphical objects are defined principally by their vertices.
  4. Transform the vertices, and the object is transformed.
  5. Color the vertices, and the whole object's color is defined by interpolation.
  6. `OpenGL is a state machine.
  7. Some subroutines set internal variables; others use them.
  8. You can examine the internal state. (This sounds obvious, and is a good design practice, but not all systems do this.)
  9. Programming a state machine:
    
        set_color(red)
        set_viewpoint(roofofcii)
        start_line(p1)
        draw_to(p2)
        start_line(p3)
        draw_to(p4)
        set_color(green)
        ...
        
  10. Programming a non-state machine:
    
        draw_line(red,roofofcii,p1,p2)
        draw_line(red,roofofcii,p3,p4)
        draw_line(green,...)
        
  11. `OpenGL omits some functionality.
  12. ''You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away.'' - Antoine de Saint-Exupery, Wind, Sand and Stars
  13. Interactive user interfacing, windowing functions are left to the individual OS.
  14. These would be hard to make portable since they are OS-specific.
  15. Nevertheless, a basic package is supplied, in GLUT, the graphics library utility toolkit.
  16. The major portable windowing system is the X window system.
  17. It complements `OpenGL, which can run on top of it.
  18. It runs on most platforms.
  19. It runs over networks.
  20. Other design choices are possible and have been made in other systems.
  21. Pipeline steps. (As GPUs get more powerful, this becomes more flexible).
  22. Vertex processor
  23. Transform vertices
  24. Determine their color
  25. The vertex processor is programmable.
  26. Clipping and primitive assembly
  27. Remove the parts of primitives (lines, polygons, etc) that lie outside the clipping volume.
  28. This changes the vertices.
  29. Rasterization
  30. Find the potential pixels, or fragments caused by each graphic primitive.
  31. Each fragment has position in frame buffer, depth, color, transparancy.
  32. Fragment processing
  33. Find frontmost fragment at each location.
  34. Blend partially transparant fragments.
  35. The fragment processor is programmable.
Explore all pages →Back to top ↑