-
lighting
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!!
-
Re: lighting
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);
...
-
Re: lighting
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules