PDA

View Full Version : Blending Problems



jono_123
05-04-2002, 03:05 PM
i draw to the screen a textured cube and then enable blending and make sure depth testing is disabled then wrote :
glColor4f(0.5,0.5,0.5,0.5);
glBegin(GL_QUADS);
//front
...(stuff that draws the front face)
//back
...
//top
...
//bottem
...
//left
...
//right
glEnd();
and it draws the cube with the texture on it and it is blended but when i rotate it so that another face is facing me, sometimes it looks more transperent or less depending on which face im viewing

can anyone help?

Nutty
05-05-2002, 01:53 AM
IT sounds like you're drawing your transparent cube faces in the wrong order.

When you draw transparent primitives, you have to render them in the order back to front. Otherwise it doesn't look right.

A trick for convex objects, is to do this.

Enable Front face culling.
Render Object.
Enable Back face culling.
Render object.

That way, the polys in front of the object will be drawn over the top of the polys behind, regardless of how you rotate it.

See the CVA demo on my website to see this in action. www.nutty.org (http://www.nutty.org)

Nutty