// TP Shader // Fabrice Aubert varying float diffus, spec; varying vec4 couleur_diffus; varying vec3 N, H; void main() { vec3 L, R; // Diffus N = normalize(gl_Normal*gl_NormalMatrix); L = normalize(gl_LightSource[0].position.xyz); diffus = max(dot(N, L), 0.0); // Spec //R = 2.0 * dot(N, L) * N - L; H = normalize(gl_LightSource[0].halfVector.xyz); /* spec = dot(N, H); */ /* spec = pow(spec, gl_FrontMaterial.shininess); */ couleur_diffus = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * diffus; /* couleur_spec = gl_FrontMaterial.specular * gl_LightSource[0].specular * spec; */ gl_Position = gl_ProjectionMatrix*gl_ModelViewMatrix*gl_Vertex; // ou gl_Position=ftransform(); }