Original Post
Hi all: I want to add fog effect to my scene. Here is my initialization of fog: But when I run it, it produces a grey screen. All objects in the scene are not shown properly. Why is that?? Thanks in advance!
void FogEffect(){
GLfloat fogColor[4] = {0.5, 0.5, 0.5, 0.5};
fogMode = GL_LINEAR;
glFogi(GL_FOG_MODE, fogMode);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_DENSITY, 0.35);
glHint(GL_FOG_HINT, GL_DONT_CARE);
glFogf(GL_FOG_START, 1);
glFogf(GL_FOG_END, 5);
glEnable(GL_FOG);
glClearColor(0.5, 0.5, 0.5, 0.5);
}