How precedence of Pixels in two List works?

Hi,
I have create two list (say one cube and one plane) using glNewlist and then I draw them one before the another. The problem is that if the figures overlap, whichever one I draw the last will appear (at any specific pixel) not the one that is closer to me (or less deeper into screen)
I appreciate you help.

It sounds like you might be forgetting to enable your depth buffer. Does your setup
include the lines
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
?

Thanks I got it to work, I had commented out glEnable(GLDEPTH_TEST) , because with that I could draw nothing, but then I figured that I need to Clear the Depth Buffer, Thanks again,

Originally posted by chmod:
It sounds like you might be forgetting to enable your depth buffer. Does your setup
include the lines
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
?