Am I correct that the OpenGL depth buffer has values between 0 and 1 while the z component of gl_Position is between -1 and 1?
1 Answer
Yes, gl_Position.z
should be between [-1, 1] after dividing gl_Position.w
, otherwise will be clipped.
OpenGL will map [-1, 1] to [0, 1], use glDepthRange(near, far)
can change the default value.