I am making a program in opengl. I have a 3dstudio max city and thought it would be cool to add fog. I have a lot of polygons in my city (~5300).
glFogi(GL_FOG_MODE, GL_EXP);
//glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_DENSITY, .002f);
glHint(GL_FOG_HINT, GL_DONT_CARE); glFogf(GL_FOG_START, 0); glFogf(GL_FOG_END, 5.0);
is the code i have in my init. I have a keybaord function that goes
case ‘g’: g_bFog = !g_bFog;
if(g_bFog)
glEnable(GL_FOG);
glDisable(GL_FOG);
break;
Now the fog enables ok and everything its just that my frame rate gets killed when fog is enabled. It goes from 55 or so to 9. I tried linear, exp and exp2. Another help in optimizing this somewhat would be great. Thanks!