Strange lighting problem
I have a quite strange problem with my opengl program. The lighting is affected by how my camera is rotated. If I look on a cube and look around the cube goes colored (by the color of the ligth) but if i look straight into it it has normal texture. Any ideas what it could be?
Set you light position after you call gluLookAT() and before you do anything else every frame...
first off - whenever you do any rotations or anything with the camera make sure you change the matrix mode to GL_PROJECTION, then switch back to GL_MODELVIEW to move lights around ,etc...
next off, are you doing directional or positional?
next off, are you doing directional or positional?
Quote:Original post by AfroFire
first off - whenever you do any rotations or anything with the camera make sure you change the matrix mode to GL_PROJECTION, then switch back to GL_MODELVIEW to move lights around ,etc...
Mmmm... no.
The projection matrix should only define the type of projection (so to speak), meaning glFrustum, glPerspective, glOrtho etc. Think of it as the matrix stack that is used to choose the lens for your camera (but not the position/orientation of it).
The modelview matrix is used for all rotations and translations, whether you consider them moving the camera, an object or a light source.
Perhaps posting some code would help?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement