title: Adding a shadow map to a closed source single pass fixed function pipeline OpenGL 1.x game
body: <p>I've been hacking a very old fixed function pipeline OpenGL 1.x game. I've been intercepting opengl calls and injecting all sorts of modern opengl elements, such that I've achieved new lighting and added post processing shaders (programmable pipeline).</p>
  <p>I'd like to generate a shadow map (for real time shadows) for this game which does not currently support this. As I understand, I need to perform multipass rendering which the game currently does not support, and I need one of those passes to use the light source as the camera position, to produce a shadow map.</p>
  <p>I was thinking I could double up the draw calls (drawelements and drawarrays) and for one of each call, use gluLookAt to transform the scene to the perspective of the light position, and render this to a framebuffer, and then revert the camera and proceed rendering</p>
  <p>I'm not sure i understand the opengl state well enough to do this however, as every use of gluLookAt prior to the individual rendering calls gives me very funky results, even if I supply the current camera position I pull from the modelview matrix. these funky results are just like, some random vertices are in the correct place and many are not, and they are flashing and moving all over the place</p>
  <p>I assume I should not be trying to transform the camera at the moment of the individual render call for a vertex array.. but im not sure what to do next because i need two passes.</p>
  <p>Question: Is there a specific time during the rendering calls that it makes sense to perform the gluLookAt, or a way to use it to transform the entire scene from within the context of a single rendering call?</p>
  <p>The only other thought I have is actually recording all the rendering and matrix transformations in order and replaying them for a second pass.</p>