PDA

View Full Version : Blending-overlapping question



fortikur
05-12-2004, 04:20 AM
I want to display two shadow "spots" under my 3d characters. I use two quadrics (is this the right word for two triangles, which form a rectangle?) with the same black spot map as the shadow. The map is made of a black spot, which attenuates towards its edges and the background is white. I set the alpha values correctly: where the map is white, it's transparent.
But if two quadrics with this texture overlap, one of them always "erases" the second one on the overlapping points, which means, it isn't really transparent, just lets me see the background.
I use the following code:

.
.
glLoadIdentity();
gluPerspective(...
glMatrixMode( GL_MODELVIEW );
gluLookAt(...
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glCallList(17);
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
glPopMatrix();
.
.

This code is used in a loop to display the objects (quadrics(?)).
What can be the problem?

endash
05-12-2004, 11:36 AM
I'm guessing they are depth fighting. Try disabling writing to the depth buffer before drawing these.

I would call them quads.

fortikur
05-12-2004, 12:01 PM
That was simple. You're right. I've disabled depth test and it works. Thank you