At first I wondered why NDC ranges from -1 to 1, rather than from 0 to 1. I figured maybe having the origin at the center is useful for something.
But why is it using a left-handed coordinate system?
Could it be just so that the Z-value is higher for objects farther away? That would be a good enough reason for me.
But why is it using a left-handed coordinate system?
Let's add "by default" to that question. Because all that's needed to change it is glDepthRange(1.0f, 0.0f);
and now you're right-handed. And yes, that is perfectly legal GL syntax; there has never been a restriction that the range near z is less than the range far z.
Why is it left-handed by default? Maybe someone on the ARB liked it that way. Maybe someone on the ARB liked increasing depth range instead of decreasing, and the lower-left corner orientation made that necessary. Maybe because the progenitor of OpenGL, IRIX GL, did it this way and the ARB didn't see any need to change it.
The reason for this is immaterial; handedness is purely a notational convenience. In some places, right-handed makes sense. In others, left-handed makes sense. And since it is trivially changed, just use what works for you.
It would then be consistent with everything else.
Consistent with what everything else? All of the fixed-function stuff that's been removed?
The viewport transform is all done by OpenGL internally, where nobody can get at it. You don't even provide a matrix; you just provide a viewport and depth range. So from the perspective of someone using fixed-function GL, everything really is right-handed.
The only time the handedness even comes up is when dealing with vertex shaders directly, where you have to know what the handedness of the clip-space is. And in that case, the change in handedness is a simple function of the perspective projection negating the Z. Or, if you like left-handed coordinates, the perspective projection not negating the Z. Or again, just reverse the glDepthRange
and now you're right-handed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With