Blending Problem

hi there
i have made a cube with a texture on it
then before the cube is drawn i enabled blending and set it to (GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
then i had glColor4f(1.0,1.0,1.0,0.5);
then i drawed the cube. it looks fine like it is untill you rotate it and the blending goes all funny what is going wrong???

[This message has been edited by jono_123 (edited 07-10-2002).]

[This message has been edited by jono_123 (edited 07-11-2002).]

[This message has been edited by jono_123 (edited 07-11-2002).]

Are you explicitly drawing your polygons back-to-front? If not, this would definitely explain why your cube would look fine from one orientation but would look wrong as it rotated around and faces were drawn front-to-back.

i think that is the problem because when you rotate 180 it looks completly around the wrong way
how do i get around this problem?

Before drawing the primitives, sort them according to the distance from the viewpoint, with the longest distance first, an then draw them. This mean you have to draw them in different order depending on angle of rotation.

You can also display the blended polys last, and disable depth writes before drawing them.

(credits to Nutty , where I saw this first)

Another nifty trick that works for convex objects (like a cube, or a sphere, but not a torus):

Cull all front faces and draw your object, then cull all back faces and draw your object again.

yes that might work but is it possible to get actual values straight from the depth buffer???