4

Working with Shaders

Welcome to Chapter 4! In the previous two chapters, we created renderers for OpenGL and Vulkan, but we addressed only the application part of the drawing: how to store the data in a simplified model and how to copy the data over to the GPU via a vertex buffer.

The GPU needs to know what to do with the data too. We must tell the graphics card in which format, sizes, and order the data for the vertices arrives, whether and how we would like to transform it, and how to apply colors or textures to the objects we sent.These steps are done in so-called shaders, which are small programs running on the compute units of your graphics card.

In this chapter, we will take a deeper look into the basic functionality of shaders. You ...

Get C++ Game Animation Programming - Second 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.