So, ive been transitioning to modern opengl recently and it's going rather well. But alas, something must go wrong. As the titel says, all I'm getting is a completely black quad. (Ive double checked my C++ code and I'm pretty sure it has nothing to do with that.)
#version 330 core //Vertex shader layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 1) in vec3 vertexColor; layout(location = 2) in vec2 vertexUV; layout(location = 3) in vec3 vertexNormal; out vec3 vertNorm; out vec3 fragmentColor; out vec3 vertPos; out vec2 UV; uniform mat4 MVP; void main(){ gl_Position = MVP * vec4(vertexPosition_modelspace,1.0f); UV = vertexUV; fragmentColor = vertexColor; vertPos = vertexPosition_modelspace; vertNorm = vertexNormal; } //Fragment shader #version 330 core in vec3 Normal; in vec3 fragmentColor; in vec3 vertPos; in vec2 UV; out vec3 color; uniform sampler2D textureSampler; uniform mat4 Model; void main(){ vec3 lightPos = vec3(0, 0, 0); mat3 normalMatrix = transpose(inverse(mat3(Model))); vec3 normal = normalize(normalMatrix * Normal); vec3 fragPosition = vec3(Model * vec4(vertPos, 1)); vec3 surfaceToLight = lightPos - fragPosition; float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal)); brightness = clamp(brightness, 0, 1); color = vec3(brightness * 1 * (texture(textureSampler, UV).rgb * fragmentColor)); } But if you require my c++ code, say so and ill edit.