Last week I've run into a problem but can't find what's causing the problem.
The problem is as follows. I have a sphere and a light source. When the sphere isn't rotated, the lighting looks fine:

But as soon as I try to rotate it, the lighting get's all wrong. The picture below shows the sphere when it's rotated 90 degrees around the y-axis.

My first thought is that for some reason the normals aren't rotated at all or not rotated correctly.
I'm using GLSL and OpenGL 2.
I think shaders sources are useful:
vertex shader
// The diffuse value
varying float diffuse_value;
// The normalized light position
uniform vec3 NormalizedLightDirection;
void main()
{
// Calculate the actual normal
vec3 vertex_normal = normalize(gl_Normal * gl_NormalMatrix);
// Calculate the diffuse value
diffuse_value = max(dot(vertex_normal, NormalizedLightDirection), 0.0);
// Set vertex position
gl_Position = gl_ModelViewProjectionMatrix * (gl_Vertex);
gl_FrontColor = gl_Color;
}
fragment shader:
varying float diffuse_value;
uniform vec4 DiffuseColor;
void main()
{
// Set the final color by multiplying the diffuse color with the diffuse value and then adding the ambient lighting
gl_FragColor = vec4(1.0) * diffuse_value;
}
I appreciate any advice anybody can give me.






