Vertex data transfer to the GPU
The basic data flow in the graphics pipeline is shown in Figure 2.1 of Chapter 2. The input of the first shader stage is defined by you, the programmer. There are some rules and limits, but mostly it is between “nothing at all” in simple Hello World
tutorial code, and extraordinarily complex, structured, and interleaved vertex data from games and 3D applications. As already stated at the start of the GLM, the OpenGL Mathematics library section, all data must reside in the GPU memory to be drawn.
We will copy the vertex data of the 3D models to the GPU by using vertex buffers. These are, like all other buffers, just parts of the GPU memory – in this case, dedicated to storing vertex data in it. Other methods exist, and we will talk about one of them in Chapter 14, where we will use textures as data storage instead of vertex buffers.
The OpenGL renderer from Chapter 2 and the Vulkan renderer from Chapter 3 already contain vertex...