View Full Version : Fog problems

12-11-2002, 11:20 AM
I have experienced some strange problems with fog;
I enable it in a standard way, and all is OK when I set camera with
gluLookAt(0,dist,dist, 0,5,0, 0,1,0);

But when I change it to

gluLookAt(dist,dist,0, 0,5,0, 0,1,0);

fog is perpendicular to my camera!

It's very well seen if you set fog color to black - you
get a black window with only a line with a background color across the middle of the window;

How to make fog respect gluLookAt?

Maybe it's worth mentioning - I set fog parameters (range , color, etc) only once - at enabling.

12-11-2002, 12:07 PM
You put the viewpoint transform (that is gluLookAt) in the modelview matrix.

12-11-2002, 12:44 PM
Is it correct to put
gluLookAt in GL_PROJECTION matrix stack??

I welcome to my site with some screens:
www.loiv.torun.pl/~stinger (http://www.loiv.torun.pl/~stinger)

Thank You

12-11-2002, 12:51 PM
gluLookAt should generally be done as the first thing in the GL_MODELVIEW_MATRIX. Putting it in the GL_PROJECTION matrix can mess up fog calculations, as you've found out. http://www.opengl.org/discussion_boards/ubb/smile.gif

12-12-2002, 01:40 PM
Now it's fine - thank You