View Full Version : lighting problem

09-10-2003, 02:54 PM

I have a rotating cylinder.
The problem is that when I apply lightings on it, the cylinder gets darker and darker as it rotates, and eventually it becomes black.


09-10-2003, 09:31 PM
How do you place your light source position?hah

09-11-2003, 10:58 AM
how should i place the light source?

09-11-2003, 02:06 PM
Probably a different way than what you do now... http://www.opengl.org/discussion_boards/ubb/smile.gif

Things to think about when placing lights that might help you figure out your problem.

1) glLightfv(..., GL_POSITION/GL_SPOT_POSITION, ...) calls are affected by the current MODELVIEW matrix.
2) glLightfv(..., GL_POSITION/GL_SPOT_POSITION, ...) calls are NOT affected by the PROJECTION matrix, so if you are putting things there that you shouldn't be, like glRotate/glTranslate/glScale, your lighting calculations won't work like they should.

09-11-2003, 07:34 PM
If things change over time, the problem is mostlikley that you dont use 'glLoadIdentity' or that your are messing with the matrixmode.

Both are common beginners mistakes.