Lighting problem with fog and light enabled

I wrote a nice little cube with a texture. I added lighting. I added blending, and it became transparent. When I added fog, the cube became all white. If I turn of the light, everything looks ok. What’s the problem.
Here are the lines ( I consider) important from my code :

GLfloat LightAmbient[]={ 0.5f, 0.5f, 0.5f, 1.0f}; // Ambient Light
GLfloat LightDiffuse[]={ 1.0f, 0.0f, 0.0f, 1.0f}; // Diffuse Light
GLfloat LightPosition[]={ 0.0f, 0.0f, 2.0f, 1.0f }; // Posiiton Light
GLfloat fogColor[]= { 0.5f, 0.5f, 0.5f, 1.0f}; // Fog Color

// in InitGL() :

glClearColor( 0.5f, 0.5f, 0.5f, 1.0f); //Clear Background Color To Gray



More lines from your code would probably help more. For instance, how you setup the fog and lighting (and where.)

Also, are you using the projection matrix for anything other than setting up an orthographic or perspective matrix? (i.e. anything that is not glFrustum/glOrtho/gluPerspective/gluOrtho2D like gluLookAt/glTranslate/etc.)
Trying to do “camera” transformations on the projection matrix instead of the modelview matrix can screw up fog and light calculations.

More lines of my code :
// Global variable :
GLuint fogMode[]= { GL_EXP, GL_EXP2, GL_LINEAR};

// in InitGL() :

glClearColor( 0.5f, 0.5f, 0.5f, 1.0f);

glEnable(GL_FOG); glFogi (GL_FOG_MODE, fogMode[fogfilter]);
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, 5.0f);

glClearDepth( 1.0);
glDepthFunc( GL_LESS);
glEnable( GL_DEPTH_TEST);
glShadeModel( GL_SMOOTH);
glMatrixMode( GL_PROJECTION);
glLoadIdentity( );

gluPerspective( 45.0f, (GLfloat)Width / Height, 0.1f, 100.0f);

   glMatrixMode( GL_MODELVIEW); // The Modelview Matrix

glLightfv( GL_LIGHT1, GL_AMBIENT, LightAmbient);

glLightfv( GL_LIGHT1, GL_DIFFUSE, LightDiffuse);

glLightfv( GL_LIGHT1, GL_POSITION, LightPosition);

glEnable( GL_LIGHT1);

// In DrawGLScene() :

glLoadIdentity( );
glTranslatef( 0.0f, 0.0f, z);
glRotatef( xrot, 1.0f, 0.0f, 0.0f);
glRotatef( yrot, 0.0f, 1.0f, 0.0f);

glBegin( GL_QUADS);
// A cube is drawn here with normals set and everything

Hope that’s enough. If anyone wants the code, I would gladly send it if he asks so, and if he posts his email address.

If you’re using fog, then shouldn’t your background be whitened too? If so, then your blended cube might just showing through.
Could you send your source to please?–Maybe it could help me with some problems i’ve been having.

As you may see, the fog color is the same as the color I use in glClearColor, so this isn’t the problem. I sent you my source, maybe you’ll see what’s wrong.