View Full Version : Lights
07-11-2001, 05:01 AM
Getting a bit frustrated now, I'd be very grateful for some help.
My light changes at the strangest occasions. If I use cout << lightposition it becomes clear that the light is at the same position every loop. Could it be the position that changes BETWEEN start and end of loop, or does it have to be the objects that moves?
Thanks in advance
07-11-2001, 05:13 AM
Um, I'm not sure what you mean. Can you be a bit more specific. Whats the problem? Are there objects that are not lighted at certain times, or is there no light at certain times?
07-11-2001, 05:19 AM
The thing is, I do the following:
glLightfv(GL_LIGHT1, GL_POSITION, myposarray);
**move and draw objects**
and so on...
this continues with push-draw-pop for all different objects.
If some objects NOT are drawn, the lighting is incorrect, but if one object is placed in the scene or one object in the scene is swapped to another one (are you with me? http://www.opengl.org/discussion_boards/ubb/wink.gif)
then the lighting gets correct...
07-11-2001, 05:27 AM
things are improving...it had something to do with the 4th parameter directional/positional light.
Now, the objects dont move or whatever they did, BUT before one object has been "laid down" on the grid that i have, (it's kind of an editor), the gridcolor is gray...after one object is laid down, the color gets white...
07-11-2001, 06:22 AM
At last the problem was solved.
The grid was drawn using GL_LINES, which don't have any normals. That made the light on the lines depend on the last drawn polygons normals.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.