I am implementing shadow map in GLSL shader and got something like the attached image. I am pretty sure as you can see the shadow for the left sphere is not correct. Can anyone point out why this is happening? This kind of shadow appears only for some particular view direction as I move the scene using mouse.

Looks like you aren’t rendering whole scene in the shadow map so part of the sphere doesn’t fit in. Fixing shadow camera(light source camera) properties should help you.