~/imallett (Ian Mallett)

OpenGL overview:

This tutorial is intended to be a crash course in graphics theory. It should give you enough context to know what you're doing when you're using a graphics API like OpenGL or Direct3D (the basic ideas given here are applicable to both APIs, but almost all details provided are specific to OpenGL). As this is a basic overview of the fixed function graphics pipeline, fancier stuff (e.g., shaders) as well as extensions to the pipeline (e.g., hardware tessellation) aren't presented here. This tutorial is intended to be comprehensive and complete in explaining the basic graphics pipeline, while still being as concise as possible. I'm going to try to add some diagrams eventually. Boldface terms highlight important concepts, and eventually, I'll make a glossary defining them all in one place. For now, I define them only in context. A number of the pictures here have been taken from the public domain. I list the source in mouseover text. If you're the owner of one of these images and would like me to take it down, just contact me.

Let's begin:NVIDIA GPU

The graphics card (often, GPU) is a highly optimized and very complicated chip designed to draw stuff. Specifically, when given data about a scene, its job is to "render" it into an image. In effect, (most) of the GPU's job is to turn triangles into pixels in a framebuffer (the contents of a screen in the GPU's memory).

OpenGL LogoOpenGL is NOT your graphics card. It is a programmer API that lets you talk to the graphics card. You control how the GPU turns the triangles into pixels. OpenGL is a state machine. This means that you configure it a certain way, and then do some operations. The internal flags that OpenGL (and by extension, the GPU) stores affect what the GPU does, and how it does it.

I present an idealized version of the graphics pipeline (which describes the process of drawing with a GPU). In its classic, simplest form, (that which shall be herein explained), it consists, in order, of the Application Stage, Vertex Stage, Rasterization Stage, Fragment Stage, Framebuffer Stage, and the Screen Stage.

A brief summary of the goal of each stage, as well as links to the individual pages explaining in much more detail follow. I recommend that you read through all of the pages in order, though links to all the pages in the tutorial are provided here for your convenience.

Application Stage: Here, the programmer (you!) talks to OpenGL. In this way, you have control over the following steps. Also in this stage, you give the GPU some triangles to draw.
Vertex Stage: Those triangles are defined by three vertices each. Here, the GPU arranges the vertices so that they are in the right locations on the screen.
Rasterization Stage: Here, the triangles' vertices are connected by pixels.
Fragment Stage: Here, the pixels are colored nicely.
Framebuffer Stage: Here, the pixels are written into graphics memory. Tests are applied to make sure they should go into memory (for example: if triangle A is behind triangle B, then we shouldn't draw any of triangle A's pixels!).
Screen Stage: Here, the memory on the GPU is displayed on the screen. It is only here that we get to see what happened.
Conclusion: Short summing up of everything you learned along with notes, comments, etc.

Proceed to the Application Stage.

Ian Mallett - Contact -
- 2021 - Creative Commons License