Lighting during rotation of object

Hi,

I try to add diffuse light while rotation of cube. Everything works almost perfectly. Unfortunately lighting on sides closer to source of light had bad shadow appearing. For example from left to right instead from right to left while spinning around. So I created ugly workaround in my shader and it helps. Please, help me to find the solution of this problem.


vertexShader =
            "attribute vec3 position;
"
            "attribute vec4 sourceColour;
"
            "attribute vec2 textureCoordIn;
"
            "attribute vec3 normal;
"
            "
"
            "uniform mat4 projectionMatrix;
"
            "uniform mat4 model;
"
            "uniform mat4 viewMatrix;
"
            "
"
            "varying vec4 destinationColour;
"
            "varying vec2 textureCoordOut;
"
            "varying vec3 normalOut;
"
            "varying vec3 positionOut;
"
            "
"
            "void main()
"
            "{
"
            "    vec3 lightPos = vec3(1.0, 0.3, 2.0); 
"
            "     if(sign(normal.y) != sign(lightPos.y) && normal.y != 0) {
"  // workaround
            "        positionOut = -position;
" // workaround
            "     }
"
            "    else if(sign(normal.z) != sign(lightPos.z) && normal.z != 0) {
" // workaround     
            "    positionOut = -position;
"                                                    // workaround
            "    }
"
            "    else {
"
            "        positionOut = position;
" 
            "    }
"
            "    normalOut = normal * mat3(projectionMatrix * viewMatrix);
"
            "    destinationColour = sourceColour;
"
            "     textureCoordOut = textureCoordIn; 
"
            "    gl_Position = projectionMatrix * viewMatrix * vec4(position, 1.0f);
"
            "}
";

        fragmentShader =

            "varying vec4 destinationColour;
"
            "varying vec2 textureCoordOut;
"
            "varying vec3 normalOut;
"
            "varying vec3 positionOut;
"
            "
"
            "uniform sampler2D tex;
"
            "
"
            "vec3 lightPos = vec3(1.0, 0.3, 2.0);
"
            "vec3 lightColor = vec3(1.0, 1.0, 1.0);
"
            "
"
            "void main()
"
            "{
"
            "    // Diffuse 
"
            "     vec3 norm = normalize(normalOut);
"
            "     vec3 lightDir = normalize(lightPos - positionOut);
"
            "     float diff = max(dot(norm, lightDir), 0.0);
"
            "     vec3 diffuse = diff * lightColor;
"
            "
"
            "    vec3 result = (vec3(0.1, 0.1, 0.1) + diffuse) * texture2D(tex, textureCoordOut);"    
            "    gl_FragColor = vec4(result, 1.0f) ; 
" //* destinationColour; 
"
            "}
";