uniform sampler2D tex; varying vec4 diffuse, ambient, globalAmbient; varying vec3 normal, pos; void main() { vec3 n, l; float NdotL; vec4 specularColor; float dist, distSq, att, specularFactor; n = normalize(normal); l = gl_LightSource[0].position.xyz - pos; distSq = dot(l, l); NdotL = dot(n, l); if (NdotL > 0.0) { dist = sqrt(distSq); att = 1.0 / (gl_LightSource[0].quadraticAttenuation * distSq); gl_FragColor = att * (diffuse * NdotL / dist + ambient + globalAmbient) /* * texture2D(tex, gl_TexCoord[0].st)*/; } else { gl_FragColor = vec4(0, 0, 0, 1); } }