order of objects (layers)

I want implement something like layers. e.g objects should painted in planes (different z values) … but it does not work - the order of objects is always like the painting order independ of the z-value (between 1 and -1 - I use Ortho2D mode).

Whats wrong ? how must i configure opengl ?



Just glEnable(GL_DEPTH_TEST) ??? :confused:
can he use Zbuffer with gluOrtho2D ??? :confused:

Yes the zbuffer will work with ortho2D and enabling it is about all you need to do.

He should also make sure that he has a depth buffer requested in the visual or PFD but he probably does even without trying, it should not be relied upon though, it should be explicitly requested.

Other settings like depth test have sensible settings without messing with them, although IMHO you should at least touch these calls so you know what you’re doing.

requested in the visual or PFD
you mean in the window setting ??

Thanks for your help.