are you talking 2d or 3d?
I implemented a 2d lighting shader with normal maps and I sent the light position to the shader already converted to screen coords. I even asked this somewhat similar question:
http://en.sfml-dev.org/forums/index.php?topic=17352.0
so if you are talking 2d I can give you more info.
Yes I am talking about 2D. I have already implemented the shader with the approach outlined in the OP. The code is here:
uniform sampler2D texture;
uniform vec2 light_position;
uniform vec4 light_color;
uniform float light_intensity;
uniform vec2 topleft;
uniform vec2 topright;
uniform vec2 bottomright;
uniform vec2 bottomleft;
vec2 resize_vect(vec2 vect, float lenght)
{
float vect_lenght = sqrt(vect.x * vect.x + vect.y * vect.y); //get vector's lenght
vect.x = vect.x / vect_lenght; //normalize vector
vect.y = vect.y / vect_lenght;
vect.x = vect.x * lenght; //multiply it by lenght
vect.y = vect.y * lenght;
return vect;
}
void main()
{
vec2 fragment_position_x = topleft + resize_vect(topright - topleft, gl_TexCoord[0].x*3 * distance(topleft, topright));
vec2 fragment_position_y = topleft + resize_vect(bottomleft - topleft, gl_TexCoord[0].y * distance(topleft, bottomleft));
vec2 fragment_position = fragment_position_x + (fragment_position_y - topleft);
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
float intensity = (light_intensity/5) / clamp(distance(fragment_position, light_position), 0.001, 4000000.0);
vec4 light = vec4(pixel.r*light_color.r*intensity, pixel.g*light_color.g*intensity, pixel.b*light_color.b*intensity, pixel.a);
gl_FragColor = light;
(I have to multiply gl_TexCoord[0].x by 3 because I am also storing glow map and environment map in the same texture so the end of the first texture is at x = 1/3)