overlapping

Hi, I am developing some landscape terrain, but whenever I rotate the image, the triangles that are meant to be at the back overlap the front ones.It seems that whichever triangle is drawn last appears in the front.Any idea what I am doing wrong?

Thanks

Did you turn on depth checking and set the depth function correctly?
glEnable( GL_DEPTH_TEST )
glDepthFunc( ? )