View Full Version : lighting
orielh12
08-09-2004, 09:42 AM
what do you do that the lighting will stay fixed & not move when navigating in the world?? (i want fixed posinional lights in 2 different rooms in the world, one off & one on, but what ever i try to do the lights keep on moving when the camera moves)
thanx!!
Sumpfratte
08-09-2004, 11:22 PM
Hi,
if you want to have a fixed light, you have to treat the light as a point in your modelview matrix that means you have to set the position of light after your modeling transformation
1. Set first your light position at the beginning:
GLfloat light_position[] = { 1.0, 1.0, 1.0, 1.0 };
2. and then in your drawing function f.e. :
...
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(...);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
...
orielh12
08-10-2004, 12:14 AM
thanx for your help, but still i didn't manage to place the light properly.
maybe i don'y understand well the parameters for the position. what i would like is to place a light on the ceiling lighting the room. what i get is dark light in the whole world when i want the whole world lit & one room with a switch i can toggle on & off.
an more help would be very much appreciated.
thanx alot.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.