orthogonal fog ?

I rendered a rotating transparent sphere that
is sprenckled with points. When I tried to
add some fog for depth-cueing, the colors
of both, the front and the back side become
fainter while the sides of the object stay
bright. It therefore seems like the fogging
does not start from my viewing position, but
rather strangely from the two orthogonally
oriented sides.
I don’t use gluLookAt and already checked for
correct use of GL_PROJECTION - what else
could i have made wrong ?

Since there is no “correct” way to setup matrices in OpenGL (and the projection matrix is no exception), all ways are correct. It’s just a matter of what you are trying to achieve.

So please describe what you mean by “correct use of GL_PROJECTION”. It may be correct as seen from how you try to simulate a camera, but OpenGL’s fog equations may not like it.

Dear Bob,

thank you very much for your reply.
With "correct’ use of GL_PROJECTION is was refering to what I heard to be a “misuse” of it for setting up the camera position and such that is often pointed out as being a problem for correct fogging. However, I don’t use gluLookAt and rotating the object works fine. It is just that the fog starts from the middle plane that is cross-secting the object and then spreads towards both ends - the one that faces to you as the one that faces away.
(sorry for my ignorant way of describing -
I feel very stupid about all that).
I am using glOrtho - could that be a problem - somewhere I have heard about that ?

Thanks again !


Ok, but what you describe still makes me belive you use the projection matrix in the way you said you didn’t use it. The abuse of the projection matrix have nothing to do with gluLookAt, but with the fact that you use ANY kind of transformation other than a projection on the projection matrix. You said you didn’t use gluLookAt, but you use some kind of rotation. Are you sure this rotation isn’t done in the projection matrix?

Post some code, it usually helps alot.

And the type of projection used doesn’t matter, since fogging is calculated before the projection matrix. glOrtho shouldn’t affect fogging at all.

I figured out now that fogging itself works
fine. However, my object protrudes from the
viewpoint in positive and negative z-
direction and fogging doesn’t care about the
So it’s all about a mere translation (what
screws up the object rotation - but I guess
that is a different part of story now…)
Anyway, thanks for trying to help me Bob !