Two-pass Rendering

To reiterate, post-processing entails a two-step approach to the draw function.

  1. Render the scene normally, but to an off-screen framebuffer.
  2. Copy the framebuffer's color buffer to the screen, with a fragment shader manipulating the image.

Specifically, to render an object with a post-process applied…

function draw()
  1. Bind the off-screen framebuffer.
  2. Clear it.
  3. Bind the model texture.
  4. Use the model shader.
  5. Render the model.

  1. Bind the null framebuffer.
  2. Clear it.
  3. Bind the color buffer texture.
  4. Use the post-process shader.
  5. Render the screen-filling rectangle.

Note the symmetry between the two halves of this function. Each half binds a framebuffer, clears it, binds a texture, uses a shader, and draws a model. Each of these is called a pass. This is, thus, a two-pass rendering process.