How can one mix ortographic and perspective projection in openGL? Some 2d elements have to be drawn in screen space (no scaling, rotation, etc..) These 2d elements have a z position, they have to appear in front/behind of other 3d elements. So i set up orographic projection, draw all 2d elements, then setup perspective projection and draw all 3d elements. The result is that all 2d elements are drawn on top. It seems that the z values from the orto projection and the z values from the perspective projection are not compatible (GL_DEPTH_TEST).
Separately all 2d and all 3d elements work fine, the problem is when i try to mix them. Does the prespective projection changes the z values? In what way? Is it possible to use z values from orto projection mixed with z values from perspective projection for depth test, or this whole concept is flawed?
Bare opengl1.5