You are right, I was imprecise.
I will check and edit.
A question on your last remark on using a “perspective projection transform with an infinite far clip distance”: This is not what I want (I believe, if I understand correctly). I want to position a textured quad on the far plane, e.g. z=1. How would a transform help with that?
Edit: some interesting observations!
First, some statments, that I would like to have verified.
-
The clipping volume is limited by [-1,1].
-
I disable/use clipping via:
glEnable(GL_DEPTH_CLAMP);
drawQuadOnZ(1);
glDisable(GL_DEPTH_CLAMP);
-
Depth clamping allows drawing of all values z>=-1
-
The wiki claims: “So objects that go behind the camera are still clipped.”
I understand, that “behind the camera” qualifies for all values z < -1
With this caveat, I am surprised do observe that depth clamping fails to work for values z>=1 !!!
However, z<=-1 works as a charm.
The question is then: Has my understanding of NDC been wrong all along?
Is z==1 the near plane and z==-1 far?
Where is the camera in NDC?
Edit2:
“The internet” indeed claims that the viewing direction is towards -z ( for RHS or LHS?), which would concur with my observertaions of the clamping behaviour.
However, fiddling with the .z value of the plane and default GL setup, the quad is closest when z=-1 and farthest for z= 1-ulp.
I will try changing GLs handedness for the plane, maybe that will make a difference.
(Allways wanted to play with that, yay for opportunities.)
Edit3:
This is getting a bit long, I hope you will take the time and bear with me.
Assuming that
glClipControl(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
allows me to flip the handedness and remembering the sentence "where f=1 when origin is GL_LOWER_LEFT, and f=−1 when origin is GL_UPPER_LEFT. " I am surprised to discover, that it has no effect on clipping and depth mapping (tp and bottom are flipped though), smaller is closer, higher is farther.
Edit4:
OK, after some heated discussions with a colleague of mine, we have come to the conclusion that the documentation and scecification around far clipping is … dubious.
First, the spec defines the clip volume as zmin <= zc <= wc.
And this should include far=1 !
Further, the wiki defines the behaviour of depthclamp : “Depth clamping turns a frustum into a pyramid, and pyramids still end at the tip” And this corresponds with my observation, that values <-1 are not clipped.
The questions remain, where is the near plane, far plane and camera position on that pyramid.
The spec on depth clamp also states: “(effectively, there is no near or far plane clipping).” which contradicts my observed behaviour that there is still clipping on 1 (Also, requires the definition of a pyramid a bottom?).
Finally, does depth clamping require the fixed function projection magic to work effectively?
Best Regards