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?