Implementing full-screen triangle rendering
In most of the post-processing techniques covered in this chapter, you’ll need to render a textured rectangle that spans the entire screen and apply a specific fragment shader to it. To make this easier, we can use a single vertex shader that works across all of these cases. While it is straightforward to render a quad using the traditional vertex and index buffers approach, managing this can become complex when you need to handle many shader combinations across different stages of the rendering pipeline. In this recipe, we will demonstrate how to render a full-screen quad by generating geometry directly in a vertex shader. Additionally, instead of using quad geometry, we will use a single triangle covering the entire screen. Let’s explore how this is done.
Getting ready
Check out the recipe Implementing programmable vertex pulling from Chapter 5.
How to do it…
Let’s go through the code for our...