How to use Depth Buffer to render triangles intersection ?

Dear All:
I wantto show the intersection line segment of two triagles with Z-buffer.So First Step,rendering first triangle. Then enable Depth Test with DepthFunction GL_EQUAL. Finally, rendering second triangle. So I think it will just show the intersection line and first triangle on the screen. But it not works ??? Please ! Thanks for you help.

Probably because no fragments in the second triangle matches the depth buffer. Close to the interesection, the fragment either have a depthvalue slightly less than, or slightly greater than, the value in the depthbuffer.

Thanks