Chapter 2. The Basics of GLSL Shaders
In this chapter, we will cover:
- Implementing diffuse, per-vertex shading with a single point light source
- Implementing per-vertex ambient, diffuse, and specular (ADS) shading
- Using functions in shaders
- Implementing two-sided shading
- Implementing flat shading
- Using subroutines to select shader functionality
- Discarding fragments to create a perforated look
Introduction
Shaders were first added into OpenGL in Version 2.0, introducing programmability into the formerly fixed-function OpenGL pipeline. Shaders give us the power to implement alternative rendering algorithms and a greater degree of flexibility in the implementation of those techniques. With shaders, we can run custom code directly on the GPU, providing us with ...
Get OpenGL – Build high performance graphics 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.