Jump to content
  • Advertisement

Archived

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

Moho

Fog depth has no effect

This topic is 5736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have implemented fog, but the GL_FOG_START and GL_FOG_END primitives do not have any effect. I am using the fog to blend the terrain into the horizon, so would like the fog to only effect points far from the viewpoint No matter what I set GL_FOG_START and GL_FOG_END to, the fog always looks the same: float fogColor[4] = {0.0f,0.0f,1.0f,1.0f}; glFogi(GL_FOG_MODE, GL_EXP2); glFogfv(GL_FOG_COLOR, fogColor); glHint(GL_FOG_HINT, GL_DONT_CARE); glFogf(GL_FOG_DENSITY, 0.1); glFogf(GL_FOG_START, (float)5.0f); glFogf(GL_FOG_END, (float)50.0f); glEnable(GL_FOG); Can anybody explain why this is? Shaun M [edited by - moho on April 1, 2003 1:58:50 PM] [edited by - moho on April 1, 2003 1:59:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
GL_FOG_START and GL_FOG_END only have any effect when fog mode is set to GL_LINEAR. GL_DENSITY is used when fog mode is GL_EXP or GL_EXP2.

Share this post


Link to post
Share on other sites
glFog

quote:

GL_FOG_START: The params parameter is a single integer or floating-point value that specifies start, the near distance used in the linear fog equation. The default near distance is 0.0.



quote:

GL_FOG_END: The params parameter is a single integer or floating-point value that specifies end, the far distance used in the linear fog equation. The default far distance is 1.0.



GL_FOG_START and _END only work when you are using GL_LINEAR as the fog mode.

Share this post


Link to post
Share on other sites
EDIT: Do'h, I was beaten (too slow)!

That would be because you're using GL_EXP2 as the fog mode. In any EXP fog mode, the start and end have no effect, but the density affects it. Use GL_LINEAR as the fog mode, and start and end will have an effect, but the density will not.

-------------------
Realm Games Company

[edited by - greatone on April 1, 2003 2:05:53 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!