Intersecting Objects

I’ve got a cube intersecting with a square pyramid. I’ve enabled hidden surface removal and alpha testing using

GLEnable(GL_ALPHA_TEST|GL_DEPTH_TEST);

Alpha is set to 1.0 for all colors. Yet, when I run the program, there is no intersection. The one which was most recently drawn just occupies the volume. I drew them in wireframe mode to check if they are actually supposed to intersect and they do. When I draw them using polygons I don’t see the intersection. In other words, they don’t appear to merge. whichever solid was drawn last, just cuts into the other.

If you want to see what I mean, check out the image at http://www-scf.usc.edu/~cmenezes

Thanks.

glEnable(GL_AlPHA_TEST|GL_DEPTH_TEST) does not enable alpha and depth testing together: glEnable must be called once for item. You can see that depth testing is not enabled in the wireframe image because the line on the cube which is at the right-back position is drawn over the top of the line which is front-top.

As a matter of interest glEnable(GL_APLHA_TEST | GL_DEPTH_TEST) actually enables GL_LOGIC_OP! The bitfields for glEnable are not OR disjoint becuase there are too many enums!

[This message has been edited by foobar (edited 09-24-2000).]

Thanks. That cleared one thing up. The problem now is that with depth test enabled (using a separate call to glEnable), somehow, it’s the inner surfaces that are being displayed instead of the outer surfaces. I have only depth testing enabled now. How do I set it so that the correct surfaces are displayed?
I can see the intersection now, but why is it showing me the inner surfaces? Is there a particular order in which I have to draw the surfaces? Thanks a lot for helping me out.

The new image is also at http://www-scf.usc.edu/~cmenezes

[This message has been edited by carlmenezes (edited 09-24-2000).]

I think perhaps it is drawing correctly but from a different angle than you think: in the first image I thought that we were looking down on the scene from the left but maybe we are actually looking up at the scene from the right if you know what I mean Make sure your rotations and translations are correct for the image you expect to see.