Changing fog settings at runtime

Hello,

I tried to change the fog settings at runtime. But somehow the start and end ranges are incorrect. Testing the same settings right in the code I get a correct fog appearance.

Do I need to clear some fog values before I am able to reinitialize?

                Gl.glFogf(Gl.GL_FOG_START, zFar - (zFar / 5f));
                Gl.glFogf(Gl.GL_FOG_END, zFar - (zFar / 100f * 5));

Ok, sorry. I found out that fog works great. My problem has another root:

Glu.gluPerspective(fovY, aspect_ratio, zNear, zFar);

This command does not work when executed at runtime. I am changing the value for the far plane but it has no effect (at least the distance I can see is not greater).

Ok I solved it :smiley:

I forgot to switch to PROJECTION and load Identity matrix before changing the perspective:

        Gl.glMatrixMode(Gl.GL_PROJECTION);
        Gl.glLoadIdentity();
        Glu.gluPerspective(fovY, aspect_ratio, zNear, zFar);
        Gl.glMatrixMode(Gl.GL_MODELVIEW);