/************************************************************* GLSL Demo - Gouraud vertex shader (c) 2005 Antoine Bouthors, EVASION *************************************************************/ void main() { vec4 pos; pos = gl_ModelViewMatrix * gl_Vertex; vec3 lightpos = gl_LightSource[0].position.xyz; vec3 lightDir = normalize( lightpos - pos.xyz ); vec3 normal = normalize( gl_NormalMatrix * gl_Normal ); vec3 ReflectedRay = reflect( lightDir, normal ); vec3 color = vec3( pow( clamp( dot( ReflectedRay, vec3( 0., 0., -1. ) ), 0., 1. ), 10. ) ); color += gl_LightSource[0].diffuse.xyz * clamp( dot( normal, lightDir ), 0., 1. ); gl_FrontColor.xyz = .1 + .9*color; gl_Position = ftransform(); }