tessellated shapes don't draw correctly

I have a problem with filled tessellated shapes not drawing in the right order.

Here is the test image: http://www.hindbrain.net/test.png

This is the order that I’m drawing some shapes:

  1. clear the background to grey
  2. green rounded box (tessellated)
  3. red circle
  4. black rectangle
  5. red ‘x’ lines over the entire scene

So, I see that the black rectangle covers the red circle and the red ‘x’ covers everything as I expected. Why is the tessellated green box not covered by the black or red shapes? It is interesting that the red lines DO appear over the green shape.

I need the green box to be drawn first with the other shapes ‘covering’ it. How can I get this to work? In general, it seems that tessellated shapes are ALWAYS drawn last even though I’m trying to draw them first.

The problem is on a windows machine. It works correctly on the linux version.

thanks,
William

Is you projection 3D or 2D orthographic (which is what it looks like to me since it’s all flat) ?

Have you disabled glDepthtest ?
Are you drawing everything in 1 pass ?
Is a stencil buffer involved anywhere ?

It is orthographic. Everything is drawn in 1 pass. No stencil buffer used. I had not disabled glDepthtest. I tried doing that and it works now. Problem solved. Thanks.

William