Results 1 to 5 of 5

Thread: Fog problems

  1. #1
    Member Contributor
    Join Date
    Nov 2002
    Location
    Torun/Poland
    Posts
    58

    Fog problems

    Hi,
    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.
    .

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Fog problems

    You put the viewpoint transform (that is gluLookAt) in the modelview matrix.

  3. #3
    Member Contributor
    Join Date
    Nov 2002
    Location
    Torun/Poland
    Posts
    58

    Re: Fog problems

    Is it correct to put
    gluLookAt in GL_PROJECTION matrix stack??

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

    Thank You
    MichalPoplawski

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Fog problems

    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.
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Member Contributor
    Join Date
    Nov 2002
    Location
    Torun/Poland
    Posts
    58

    Re: Fog problems

    Now it's fine - thank You
    LordOfTheUniverse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean