Specifying nearVal and farVal in glOrtho

As its man documentation says, we can assume the eye locates at (0, 0, 0). But if you specify the nearVal to be a negative value, then something behind the eye is also drawn. Isn’t this counterintuitive? Is it meaningful to talk about the eye’s location in this case?

And what if you specify as nearVal > farVal? Shouldn’t everything be clipped? But actually something can be drawn.

What’s worse, it seems glOrtho inverts the z coordinate specified in the Eye Coordinate System. In the Eye Coordinate System, the eye is at (0, 0, 0) looking in the direction -z = (0, 0, -1). So everything to be displayed should have a negative z coordinate. For example, an object with z = -3 is displayed when we clip between -2 and -4. However, you should specify 2 and 4 rather than -2 and -4 as nearVal and farVal in this case. Its man documentation says nearVal and farVal mean distances. But given that you can also specify negative distances, why not just use the Eye Coordinates?

Is there anyone who can help me explain these? Thanks.

Yeah, with orthographic projections, you don’t have an eye “point”. The eye rays don’t converge to a point like they do perspective. You actually have an “eye plane”, and that plane is at Z=-nearval.

The ortho cube (rectangular parallelipiped, really) is just used to cull space, and for Z specifically, to define what Z range is mapped to 0…1 in the depth buffer (assuming glDepthRange 0…1).