Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: what is the range of clipping space in OpenGL?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    20

    Question 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 09:50 PM.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    20
    as you mentioned window-space is a 3d coord, right? I thought it was mapped from ndc and was a 2d coord.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •