Transforming geometry from local to clip space is usually performed by the vertex shader, though any other vertex processing stage (tessellation or geometry) may accomplish this task. The transformation is done by specifying model, view, and projection matrices and providing them from the application to the shaders as three separate matrices, or as one, joined model-view-projection matrix (in short MVP). The most common and easy way is to use a uniform buffer through which we can provide such a matrix.
Writing a vertex shader that multiplies vertex position by a projection matrix
How to do it...
- Create a vertex shader in a text file called shader.vert (refer to the Writing vertex shaders recipe).
- Define an input variable (attribute) through which vertex positions...