Getting ready

Set up two framebuffer objects (refer to the Rendering to a texture recipe in Chapter 5, Using Textures), and two corresponding textures. The first FBO should have a depth buffer because it will be used for the first pass. The second FBO need not have a depth buffer because, in the second and third passes, we'll only render a single screen-filling quad in order to execute the fragment shader once for each pixel.

As with the previous recipe, we'll use a uniform variable to select the functionality of each pass. The OpenGL program should also set the following uniform variables:

  • Width: This is used to set the width of the screen in pixels
  • Height: This is used to set the height of the screen in pixels
  • Weight[]: This is the array ...

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.