   Normals transform incorrectly
  I'm having a problem with what should be a very simple shader. The normals on my imported models don't seem to be transforming properly when the model is rotated. This first screenshot shows the model being lit by a very bright light when it is initially placed.This second shot is after I've rotated the model 180 degrees on the y-axis, so it's now showing the opposite side of the pillar.As can be seen, the normals are not being displayed as they should. To see it in motion it almost looks like the normals are being rotated in the opposite direction of the way the model is rotating.The following is the code for my vert and frag shaders. If anyone has any idea where I'm going wrong I would be very grateful.//VERTvoid main(){    vertDiffuse = material_diffuse * gl_LightSource[0].diffuse;    vertAmbient = material_ambient * gl_LightSource[0].ambient;    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;    gl_TexCoord[0] = gl_MultiTexCoord0;    normal = normalize(gl_NormalMatrix * gl_Normal);   vec4 ecPos = gl_ModelViewMatrix * gl_Vertex;    vec3 aux = vec3(gl_LightSource[0].position - ecPos);    dist = length(aux);lightDir = normalize(aux);}//FRAGvoid main(){    vec4 color = vec4(0.0);   vec3 l = normalize(lightDir);    float nDotL = max(0.0, dot(normal, l));    if (nDotL > 0.0)    {color += vertDiffuse * nDotL;    }   float attenuation = 1.0 / (gl_LightSource[0].constantAttenuation +  gl_LightSource[0].linearAttenuation * dist +  gl_LightSource[0].quadraticAttenuation * dist * dist);   gl_FragColor = (vertAmbient + (color * attenuation)) * texture2D(colorMap, gl_TexCoord[0].st);    gl_FragColor.a = 1;}
  I'm gonna take a guess and say that when doing your lighting your LightPos is in world space, while your normals are in view space. Both normals and lightpos have to be in the same space to get correct results. You can fix this a few ways: Multiply lightpos by the view matrix.Multiply normals by model matrix only instead of modelview matrix (modelview is essentially the same as normalmatrix, with some minor scaling differences)Are you defining your lightpos before your camera transformations? I think that will be the reason you have this problem.   ;  Currently I'm just sending hard coded constants to the light source position just before rendering the mesh. And for your suggestions of multiplying the normals or the light position by the model/view matrix, I assume you mean in the shader. Does OpenGL have some way of determining either the model or the view matrix separate from the other?   ;  Not with the default matrices. The proper thing to do is to build define your own matrices and send them to the shader as uniforms.For a short term fix what I think you want to do is move where you setup your light source. The position you define with glLightfv is NOT the same set of values that come out of gl_Lightsource. If you call glLightfv(lightVector), then this is multiplied by whatever is currently in the modelview matrix and presented in the shader as gl_Lightsource. To do it properly, you should do the following:glSomeMatrixOperations() //setup your cameraglLightfv() // define the light position in World spaceglSomeMatrixOperations() // setup your modelglDrawElements() //draw the modelIt makes a difference where you call glLightfv. If you just want to send values directly to the shader, use a uniform and not the special variables.   ;  Works great, thank you very much, you've saved me quite a headache.   