Platformer in OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 regels
506 B

#version 150
in vec4 fPosition;
in vec4 fColor;
in vec4 fLightPosition;
in vec3 fNormal;
// output
out vec4 color;
void main(void)
{
vec3 o =-normalize(fPosition.xyz);
vec3 n = normalize(fNormal);
vec3 r = reflect(o,n);
vec3 l = normalize(fLightPosition.xyz-fPosition.xyz);
float ambient = 0.1;
float diffus = 0.7*max(0.0,dot(n,l));
float specular = 0.6*pow(max(0.0,-dot(r,l)),4.0);
color = fColor * ( ambient + diffus + specular );
/*color = vec3(1,0,0);*/
}