I found an example for 3d. you can rotate it at free will, but when i add light, the light rotates with it. any ideas? i want the light to stay in one spot but the box to rotate.
Lights pass through the modelview matrix just as vertices do. Thus, they are moved by commands such as glRotatef() or glTranslatef. If you don’t want the light to move your drawing code might look like this:
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
where drawScene() contains drawing code and matrix transformations.
In this way, the Modelview maxtrix is restored before you put the light back into the scene.