-
Book Overview & Buying
-
Table Of Contents
C++ Game Animation Programming - Second Edition
By :
The data sent from the vertex buffer has one important drawback: it changes for every vertex. If we need some sort of values to remain constant during a frame, such as a transformation matrix, we must take a different approach. Using the CPU for this has already been ruled out as it would be too expensive and time-consuming, so we will utilize the GPU for this task.
Both OpenGL and Vulkan have a special type of buffer for this use case: the uniform buffer.
Uniform buffers have two important properties:
Any data, such as the aforementioned transformation matrices, needs to be uploaded only once per frame before the drawing starts. In the shader code, the data can be referenced like local variables, but in contrast to vertex positions, colors, and so on, it is the same for every vertex...