#version 120 attribute vec4 vertex_position; attribute vec3 vertex_normal; uniform mat4 mvp; uniform mat4 mvit; varying vec3 frag_normal; void main() { frag_normal = normalize(mat3(mvit) * vertex_normal); gl_Position = mvp * vertex_position; } --- #version 120 uniform vec4 color; // actual vertex color as defined by lglColor const vec3 l=vec3(0,0,1); // light direction vector defined in camera space const vec3 Ca=vec3(0.3,0.3,0.1),Cd=vec3(0.7,0.7,1); // Ca = ka*IL, Cd = kd*IL varying vec3 frag_normal; // transformed normal in camera space void main() { vec3 n = normalize(frag_normal); float d = max(dot(l, n), 0); gl_FragColor = vec4(vec3(color) * (Ca + Cd * d), color.a); }