varying float LightIntensity; varying vec3 ReflectVector; void main() { vec3 ECposition = vec3( gl_ModelViewMatrix * gl_Vertex ); vec3 eyeDir = ECposition; // vector from eye to pt vec3 normal = normalize( gl_NormalMatrix * gl_Normal ); ReflectVector = reflect( eyeDir, normal ); vec3 LightPos = vec3( 5., 10., 10. ); LightIntensity = 1.5 * abs( dot( normalize(LightPos - ECposition), normal ) ); if( LightIntensity < 0.2 ) LightIntensity = 0.2; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }