Archived

This topic is now archived and is closed to further replies.

Piglet

My fogging head hurts

Recommended Posts

Sometime I really hate OpenGl ( and maths, and working late etc.. ). My new problem today is that I can''t get the fog to go in the right direction !! The fog goes from dense at the ground to light in the sky rather than dense further from the camera. I had thought this might be because I use gluLookAt and set the up direction as the Z axis. However, I have changed this so the up direction is the Y axis ( as per all demo''s) and it still fogs from the ground upwards. I''m guessing its going to be somekind of matrix thing :-( My head hurts, its late in the evening, I''ve been working too hard .... Think I''ll go find a nice dark corner somewhere :-)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
fog gets denser the farther away from the camera it is. it doesnt matter what direction you look in.

Share this post


Link to post
Share on other sites
u are not positioning the ''camera'' in the projection matrix r u by any chance?
cause thats a no no

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
Is the ground/sky each one polygon? If it is, and it goes behind you, and the fogging mode is per vertex, that could be your problem. Give the ground and sky more verticies or set the fog mode to per pixel.

Share this post


Link to post
Share on other sites
I''ve tried all your suggestions, but alas, with no effect.

The code I am using to initiate fog is :-

fogCol[0] := 0.5 ;
fogCol[1] := 0.5 ;
fogCol[2] := 0.5 ;
fogCol[3] := 1.0 ;

glFogf ( GL_FOG_MODE, GL_EXP2 ) ;
glFogf ( GL_FOG_DENSITY, 0.1 ) ;
glFogfv ( GL_FOG_COLOR, @fogCol ) ;
glHint ( GL_FOG_HINT, GL_NICEST ) ;
glEnable ( GL_FOG ) ;

In my application, _ALL_ the polygons are totally grey - as in the completly the fog colour.

I''ve tried different values for GL_FOG_START and GL_FOG_END as well - no effect.

This has got to be some standard mistake that I am making ...

Share this post


Link to post
Share on other sites
Is the part where you are setting the fog mode supposed to be the floating point version of the function? I really don''t know, and don''t feel like checking right now, but you are probably just using the wrong glFog function for one of them, because it looks like it should work.

Share this post


Link to post
Share on other sites