Learn OpenGL 6
Transformations
Github source code: link
learning materials: learnopengl
Introduction
Transformations contain translation, scale, rotation or a combination of one or more of these. One thing to note
is that when combing multiple matrices, the order should be read from right-to-left
. If we want to do scale first then translation, It should look like this:
GLM
GLM stands for OpenGL Mathematics and is a header-only library. It is an easy-to-use OpenGL math library. Download it from official website, put glm
folder under your project, include needed headers.
1 |
Demo
Transformation matrices can be passed to vertex shader using uniform
from host program.
host
1 | // activate shader |
vertex shader
1 |
|