Given the following quote from the online opengl documentation for glDepthFunc:
"GL_LESS - Passes if the incoming depth value is less than the stored depth value."
Along with the following quotes from the Overlap and Depth Buffering tutorial page:
"When the test is true, the incoming fragment is written."
I don't believe the following sentence is correct (but would very much like to understand if I'm wrong):
"So GL_LESS means that, when the incoming fragment's depth is less than the depth from the depth buffer, the incoming fragment is not written."
Shouldn't it be?:
"So GL_LESS means that, when the incoming fragment's depth is less than the depth from the depth buffer, the incoming fragment is written."
As a beginner this is my understanding of the described depth comparison process:
Writing 1st wedge object
offsetUniform.z is 0.0f so window-space Z value is 0.0f
No previous depth value stored so glDepthRange Max used
(winZ GL_LESS DepthRangeMax) comparison is actually (0.0f < 1.0f = TRUE)
Therefore: fragment colour written and current depth of 0.0f written
Writing 2nd wedge object
offsetUniform.z is -1.0f so window-space Z value is 1.0f
Previous depth value stored is 0.0f
(winZ GL_LESS PreviousDepthValue) comparison is actually (1.0f < 0.0f = FALSE)
Therefore: fragment colour is not written and current depth remains 0.0f
To me this process corresponds with the output image shown in Figure 5.3.