   lights flickering
  I'm setting up directional lighting in OGL with something like:float pos[3] = { 1, 0, 0, 0 }; glLightfv ( GL_LIGHT0, GL_POSITION, pos );glEnable( GL_LIGHT0 );Which works fine, until I start moving my camera around. At certain camera positions my meshes will look like they are being lit from (-1,0,0)! It could be my modelview matrix is messed up, but if that were the case wouldn't my geometry come out messed up? The geometry gets rendered fine, its just the lighting that flips sometimes. I'm totally stumped by this.   
  Light positions are multiplied by the current model-view matrix. Make sure you are designing around this.  That is, either specify light coordinates relatively (horrible), or set your light positions when your model-view matrix is still the Identity.   ;  If you are using shaders, it is possible to multiply the light position with the modelview matrix to make it work correctly. Otherwise moving the glLight(..GL_POSITION..); line to a position after you modify the opengl matrices, it should work also.   ;Quote:Original post by indigox3I'm setting up directional lighting in OGL with something like:float pos[3] = { 1, 0, 0, 0 }; glLightfv ( GL_LIGHT0, GL_POSITION, pos );glEnable( GL_LIGHT0 );Which works fine, until I start moving my camera around. At certain camera positions my meshes will look like they are being lit from (-1,0,0)! It could be my modelview matrix is messed up, but if that were the case wouldn't my geometry come out messed up? The geometry gets rendered fine, its just the lighting that flips sometimes. I'm totally stumped by this.The checklist in this FAQ is a good place to start if you have lighting issues. It certainly doesn't cover all possible problems, but at least it covers the most common lighting mistakes.From your description, it sounds like the lighting position is not properly placed (point four in the FAQ), although it is impossible to tell without the code surrounding your glLightfv(...). Your code should look something like this:void MainLoop(){    glMatrixMode(GL_MODELVIEW);    glLoadIdentity(); // clean matrix    gluLookAt(...);   // create the view matrix    glLightfv(.., GL_POSITION, ..);   // define the light in world coordinates    for (i = 0; i < all_objects; i++)    {    transform(object); // setup the model matrix    draw(object); // draw all objects}}Note, if you place the glLightfv() before the gluLookAt() (or whatever you use to setup the view matrix) the lighting is defined in camera space which could explain the behaviour you experience.Tom   ;  Thanks , I figured it out. My camera was just generating a weird view matrix. I'm not sure why this didn't mess up the rendering of the geometry, but at least the problem is gone. 