#version 120

varying vec4 p;
varying vec4 n;

void main()
{
  vec4 normal = normalize(n);
  vec3 norm = vec3(normal.x, normal.y, normal.z);
 
  vec4 npos = normalize(p);
  vec3 pos = vec3(npos.x, npos.y, npos.z);

  float product = dot(norm, pos);

  if(product <= 0.3 && product >= -0.3)
    gl_FragColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
  else
    gl_FragColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);
}
