If you draw different polygons so they are very nearly co-planar, the depth buffer’s loss of precision will most likely have a problem figuring it out. This results in what is called z-fighting, were some pixels of one polygon win and others, right next to it, are from the other colored polygon. Obviously this is pretty ugly.
As gouessej said, glPolygonOffset is a way to solve this problem. Essentially, it allows you to declare which polygon is the winner in an effective tie. There are problems with glPolygonOffset because it can be implemented differently on different hardware, making one offset value acceptable on a Nvidia card still not look good with an ATI card.
That being said, if you need your boxes to be co-planar, you should experiment with using it; otherwise, I’d make them not on the same plane.
–
And, if you’re positive that the boxes aren’t drawn with faces on the same plane, then we have a more serious issue. My best guess, in that case, would be that your depth buffer is screwed up and isn’t being cleared correctly.