How to implement Uniforms in Vulkan?
In this section, we will understand the requirements and execution model for a Uniform implementation in Vulkan. We will also describe the step-by-step instructions to apply 3D transformations on the rendered object using Uniforms. Reuse the sample recipe from the previous chapter and follow the given instructions.
Prerequisites
Let's check out the requirements first.
3D Transformation: This implementation uses the glm
mathematics library to achieve 3D transformation using the library's inbuilt transformation functions. GLM is a header-only C++ mathematics library for graphics software based on the GLSL specification. You can download this library from http://glm.g-truc.net. In order to use it, perform the following changes:
- CMakeLists.txt: Add GLM support by adding the following lines to the project's
CMakeLists.txt
file:
# GLM SETUP
set (EXTDIR "${CMAKE_SOURCE_DIR}/../../external")
set (GLMINCLUDES...