// Simple lighting model varying vec3 N; varying vec3 v; // Fragment shader entry point void main() { // Calculate lighting parameters vec3 L = normalize(gl_LightSource[0].position.xyz - v); vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(N,L), 0.0); Idiff = clamp(Idiff, 0.0, 1.0); // Make it green gl_FragColor = Idiff; gl_FragColor.x = 0.0; gl_FragColor.z = 0.0; }