How do I add light to my textures using this? I have this
GLfloat ka = 1.0;
glm::vec3 ia = glm::vec3(0.5f, 0.5f, 0.5f);
and in the fragment shader
out vec4 color;
in VS_OUT
{
vec2 tc;
vec3 normals;
}
fs_in;
layout(binding=0)uniform sampler2D tex;
void main(void)
{
color= texture(tex, fs_in.tc);
}
We were given this example but I don't understand what to do.
out vec4 color;
uniform vec3 materialColor;
uniform vec3 ia; // Ambient colour
uniform float ka; // Ambient constant
void main(void){
color = vec4( ka * ia , 1.0);
}
Help?