0
\$\begingroup\$

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?

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.