#version 330 core layout(location=0) in vec3 position; layout(location=1) in vec3 normals; uniform mat4 modelMatrix; uniform mat4 viewMatrix; uniform mat4 projectionMatrix; //out vec3 fragPos; //out vec3 fragNormal; void main() { vec4 pos = vec4(position, 1.0); // the inverse should be calculated on the CPU as it is quite expensive to run and doesn't need to be run for every vertex // fragNormal = mat3(transpose(inverse(modelMatrix))) * normals; // fragPos = vec3(modelMatrix * pos); gl_Position = projectionMatrix * viewMatrix * modelMatrix * pos; }