Fog with Blend in OpenGL
Posted
by
MhdAljobory
on Game Development
See other posts from Game Development
or by MhdAljobory
Published on 2012-05-18T11:37:56Z
Indexed on
2012/07/02
21:24 UTC
Read the original article
Hit count: 177
I want to add fog in my scene which contain transparent textures made by Blend ,
when i enable the fog the transparent textures appear white From a distance but when i disable it the textures appear well.
What is the solution to the problem of whiteness?
Fog Code:
GLfloat fogColor[4]= {0.5f, 0.5f, 0.5f, 1.0f};
glClearColor(0.5f,0.5f,0.5f,1.0f);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_DENSITY, 0.35f);
glHint(GL_FOG_HINT, GL_DONT_CARE);
glFogf(GL_FOG_START, 1.0f);
glFogf(GL_FOG_END, 1000.0f);
glEnable(GL_FOG);
Screenshot
© Game Development or respective owner