17

Vertex and Fragment Shading

The rendering of the models we’ve achieved thus far has used OpenGL’s deprecated API calls along with mathematics calculated on the CPU by Python to draw, texture, and light images on the screen. If you have tried to render models with many vertices using the current project, you’ll have noticed how slow the methods become as the vertex count increases. Even the original teapot model from Chapter 8, Reviewing Our Knowledge of Triangles, starts to slow down the application.

To speed up rendering, a graphics card (GPU) can be used to process vertices and pixels in parallel. To move the logic and algorithms we’ve written thus far onto the GPU, we must first learn how to write shader programs that are compiled and ...

Get Mathematics for Game Programming and Computer 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.