Hi, first of all I am sorry for my English…
I have a simple light like this:
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glLightfv( GL_LIGHT0, GL_SPECULAR, LightSpecular);
glEnable( GL_LIGHTING );
and I am drawing some polygons that I can move using the mouse. In my drawing routine a do like this:
glRotated(xrot, 1.0, 0.0, 0.0);
glRotated(yrot, 0.0, 1.0, 0.0);
glRotated(zrot, 0.0, 0.0, 1.0);
… Drawing the polygons …
I want the light fixed and the polygons moving… Is it something about pushing the matrix and then to disable the lighting?
Thank you all.
Well, I’m a newbie and I really don’t know if the light is fixed. I am drawing just 3 faces of a cube (like the thre planes X, Y, Z). I set the light in the begining, before any drawing. But then, when I move the faces with the mouse the light doesn’t seem to be fixed. I am going to try to explain (I’m sorry for my English ).
I draw the three faces as three polygons.
When I move them, just one seems to be reflecting the light (the Z plane).
[For each polygon I put its Normal]
If I rotate the faces and put one face (the Z plane) in the front (of my window) and start to spin it clock wise, this face reflects the light just sometimes. It is like if you put a mirror in front of you and start to spin it in clock wise. The mirror must reflect you all the time!. But the face only reflects the light at 12:00 o’clock position. That is why I am thinking that the light is moving.
Maybe I should try to use glLookAt instead of glRotate and glTranslate??
I really don’t know.
Thankx for replying.