I'm currently learning lighting in OpenGL and was reading learnopengl.com when I noticed that they calculated the direction of the light (diffuse lighting) by subtracting the light position to the fragment position:
vec3 lightDir = normalize(lightPos - FragPos);
(I've attached an image to show what this would look like)
Direction Vector Image
Why would they get a vector that points from the Fragment position to the light position? If they want to get the light direction, wouldn't we want to get a vector from the light position to the fragment position:
vec3 lightDir = normalize(FragPos - lightPos);