Passing light pos/dir to GLSL in eye space

Im making some changes to a few of my shaders, I do my lighting in eye space, and Ive been setting the light position with world matrix from scene and glLight calls like this.

  • Set view by loading a view matrix in (LookAt like)
  • Push matrix, multiply light matrix in
  • set glLight position as default (0, 0, 0, 1), (0, 0, 0, 1) is transformed my modelview and stored in eye space (from docs)
  • Pop matrix
  • Push object matrix
    • render object
  • Pop object matrix

I would then get gl_LightSource[0].position in eye space in the pixel shader. Now I would like to pass the light position which I have in world coordiantes from a scene graph, directly to the shader as a uniform.
How do I accomplish the automatic conversion to eye space that I use to get from the use of glLight?

See the source of chapter 17 here

http://www.starstonesoftware.com/OpenGL/

Looking forward you probably want to send your own light data as user defined uniforms and do your own transformations.

Many more examples here

http://3dshaders.com/home/index.php?option=com_weblinks&catid=14&Itemid=34