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 6 of 6

Thread: glDepthRange (4.2+) vs. glDepthRangedNV

  1. #1

    glDepthRange (4.2+) vs. glDepthRangedNV

    In the 4.2 spec the definition of glDepthRange was changed to
    void DepthRange( double n, double f );
    from previous
    void DepthRange( clampd n, clampd f );
    with the wording changed to "If a fixed-point representation is used, the parameters n and f are clamped to the range [0; 1] when computing zw."

    So I expected it to behave like glDepthRangedNV that explicitly states that the values of n and f are not clamped. However, with glDepthRange with 4.2 core context and 306.97 NV drivers I'm reading back clamped values. Am I doing something wrong or have I read the spec incorrectly, assuming that with the floating point representation (of depth buffer) n and f would not be clamped?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    It seems to be a clear driver bug.

    Assuming that your depth buffer actually is GL_DEPTH_COMPONENT32F, of course.

  3. #3
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    781
    No, this is a spec bug. Despite removal of GLclamp, all depth values are always clamped to [0,1].

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    No, this is a spec bug. Despite removal of GLclamp, all depth values are always clamped to [0,1].
    No, that is a driver bug. The spec says what ought to happen; drivers are supposed to comply with that. If they don't, it's the driver's fault.

    This was a deliberate change in a revision of the spec document. It's even stated in the changelog for 4.2 exactly why it was changed. If a driver isn't doing what it says, that's the driver's fault. Depth values are not always clamped.

  5. #5
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    781
    The spec is wrong. Get Khronos membership and go read Bugzilla #9517.

    Depth is always clamped in core OpenGL (but not in Nvidia extensions.)

  6. #6
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    If depth is always clamped, what good is GL_DEPTH_COMPONENT32F? Is there a bug to remove that too? And who filed that bug, since the ARB deliberately made this change to allow unclamped depth ranges?

Posting Permissions

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