Skip to main content

OpenGL Graphics Pipeline

OpenGL

Graphics Pipeline

is

an abstract model that describes sequence of steps needed to render a 3D scene.

0. Core Concepts and Vocabulary 

rendering - Generate two-dimensional images of 3D scenes

shading - The darkness of an object not in direct light 

shadows - the silhouette of one object's shape on the surface of another object

frustrum - Region contained within the truncated pyramid shape outlined in white indicates the space visible to the camera.

pixel - specify colors using triples of floating-point numbers between 0 and 1 to represent the amount of red, green, and blue light present in a color; a value of 0 represents no amount of that color is present, while a value of 1 represents that color at full intensity

  • raster - rendered scene via an array of pixels (picture elements) which will be displayed on a screen, arranged in a 2D grid
  • resolution - the number of pixels in the raster, the more it is the higher the quality 
  • precision - the number of bits used for each pixel as each bit has two possible values (0 or 1), the number of colors that can be displayed 

buffer (data buffer/buffer memory) is a part of a computer's memory that serves as temporary storage for data while it is being moved from one location to another.

  • frame buffer - Pixel data is stored in a region of memory. A framebuffer may contain multiple buffers that store diferent types of data for each pixel.
    • color buffer - located in frame buffer which stores RGB values. Need this at minimum. Alpha value can also be stored 
    • depth buffer - located in frame buffer, which stores distances from points on scene objects to the virtual camera. Depth values are used to determine whether the various points on each object are in front of or behind other objects (from the camera’s perspective), and thus whether they will be visible when the scene is rendered.
    • stencil buffer - store values used in generating advanced effects, such as shadows, reffections, or portal rendering.

1. Application Stage

Initializing the window where the rendered graphics will be displayed.

  • Reading data required for the rendering process and sending to the GPU, such as
    • vertex attributes, describes appearance of geometric shapes rendered, stored as in vertex buffer objects (VBO)
    • images to be applied to surfaces, stored in texture buffers 
    • source code for vertex shader and fragment shader programs, sent to GPU to be complied and loaded.
  • Loop that re-renders the scene repeatedly, like 60 fps
  • Monitoring hardware for user inputs, handled by the CPU
  • Vertex Array Objects, manages the associations and whether they are turned on and off, between attributes data stored in VBOs and attribute variables in the vertex shader program

2. Geometry Processing

Determining the position of each vertex of the geometric shapes to be rendered, implemented by a program called the vertex shader

3. Rasterization

Determining which pixels corresponds to the geometric shapes rendered 

4. Pixel Processing

Determining the color of each pixel in the rendered image, involving a program called the fragment shader