View Full Version : local viewer - specular lights
05-21-2000, 08:55 PM
I have a problem with the specular highlights. I use the function call
glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
But still the specular highlight is calculated as if I always stand at one point, facing the negative z axis. It doesn't matter how I move around - the specular light remains "static" on the surface.
How come? Does anybody have an idea?
I'm not sure, but you should check the order in which you set your Matrices and your light. If you set ModelView Matrix before, your light will always appear in the same place (in camera space) so the hilight seems to come from the same point.
05-22-2000, 01:47 AM
Hmm... thanks for your comment, but I think the problem is elsewhere. To me it seems like the line
glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, true);
does not have any effect. The specular light remains on the surface exactly where it would be if I was facing the negative Z all the time. As I rotate around the object the highlight doesn't move around on the surface at all... looks more like a texture wrapped onto the object.
However that line of code has one effect: it seems like it makes the shininess increase. The size of the highlight becomes smaller in size!!! Well... isn't that weird?
11-18-2002, 03:50 PM
I've experienced exactly the same problem!
Unfortunately I haven't found a solution yet. Maybe a closer look to the situation will help others to understand the Problem.
- Position is (0,10,0,1)
- Direction is (0,-1,0)
- Colors are also set right (Specular & Diffuse)
I set the Localviewer to true and activated normaizing.
Here is the display code:
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
gluLookAt(cam_x, cam_y, cam_z, 0, 0, 0, 0, 1, 0);
glrotatef(anim, 1, 0, 0)
SetLight; //Updates the Position and Direction
DrawBall; //Pos (0,5,0)
DrawLight; //Sphere @ Ball's position
The Light doesn't move. Fixed local position.
But as the scene spins, the specular component of the light moves across the plane. The diffuse component looks right (stationary from top). Very Wired.
11-20-2002, 11:01 AM
try using your lookat(..) in the projection matrix instead of modelview matrix..that should fix the problem
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.