September 2018
Intermediate to advanced
472 pages
15h 36m
English
We'll use the following vertex shader:
#version 430
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexColor;
out vec3 Color;
uniform mat4 RotationMatrix;
void main() {
Color = VertexColor;
gl_Position = RotationMatrix * vec4(VertexPosition,1.0);
}
Note that the RotationMatrix variable is declared using the uniform qualifier. We'll provide the data for this variable via the OpenGL program. The RotationMatrix variable is also used to transform VertexPosition before assigning it to the default output position variable, gl_Position.
We'll use the same fragment shader as in the previous recipes:
#version 460 in vec3 Color; layout (location = 0) out vec4 FragColor; void main() { FragColor = vec4(Color, ...Read now
Unlock full access