what is the range of clipping space in OpenGL?
I'm a beginner in opengl, and I enounter a problem concering about clipping space.
I read from opengl 4.0 reference that Values specified by glClearDepth are clamped to the range 0 1.
but the normilized device coordinate(NDC) has the rang [-1, 1] right?
My question: is the value of glClearDepth applied to NDC? if it is, then how could I clip the vertex with z value between [-1, 0]?
Last edited by Sobeit; 11-30-2012 at 08:50 PM.
glViewport and glDepthRange define the extents of window-space, the space that comes after NDC space. The glClearDepth value is in window-space, not NDC space.
glDepthRange in particular defines the Z mapping from the [-1, 1] range to the user-defined depth range.
as you mentioned window-space is a 3d coord, right? I thought it was mapped from ndc and was a 2d coord.
It is mapped from NDC space; NDC space is 3D as well. OpenGL never uses purely 2D coordinates for rendering. That's where the depth comes from.