I've having trouble implementing hidden surface removal. Here's the setup. I draw two polygons. Let's call them A and B. When I enable depth test (and clear the depth buffer), then A always gets drawn in front of B (even when I move the camera to behind B). When I disable depth test, B always gets drawn in front of A.
How do I make it so that the farthest polygon from the camera is the one that gets occluded? The tutorials I've looked at merely say to enable depth testing. But it seems there's more to it than that.