View Full Version : Lighting doesn't work :(
04-23-2000, 09:33 AM
Well, my scene isn't lit at all (the polygons are rendered as if lighting was disabled), and i don't see what i'm missing.
- lighting is activated,
- i specify a normal for each vertex (the vector is already normalized),
- i use a single light (GL_LIGHT1) using ambient and diffuse parameters,
- the position of the light seems to be correct,
- the material has been created,
- i use GL_MODULATE when i bind the textures,
- the model used is GL_SMOOTH.
In addition i compiled another program which is using lighting and there is no problem. It 's not a hardware/drivers problem..
Any suggestion ?
try to check if opengl has the correct lighting state by querying it with glGet...() functions.
maybe you lost tracking of your application state...
also check if some light has a negative value, or if the global ambient is also negative.
is your appication multithreaded? if it is so, there is the chance the RC has not made current to a thread, and opengl discards commands when the RC is not current.
04-25-2000, 02:52 AM
There is huge number of possible errors.
(Posting parts of your code could help)
It might sound stupid but did you call
glEnable(GL_LIGHT1) prior to rendering the scene ?
Also be careful about your lights geometry.
Especially when setting directions and positions keep in mind that they are multiplied by the current modelview matrix and then stored in eye coordinates. So double check your light position setup.
Call glGetError followed by gluErrorString to see if anything is wrong. Do so before and after rendering your scene these two commands can help you a lot.
04-25-2000, 11:20 AM
Watch out at which point you set the lighting position (before or after the modelview matrix?)
Binding texture for the first time needs more TexEnv states to be set. Default min filtering for example is GL_NEAREST_MIPMAP_LINEAR. Did you download mipmaps?
[QUOTE]Originally posted by Ysaneya:
[B]Well, my scene isn't lit at all (the polygons are rendered as if lighting was disabled), and i don't see what i'm missing.
Any suggestion ?
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.