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 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .