Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: what is the use of glDepthRange function ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Newbie Newbie
    Join Date
    Dec 2012

    what is the use of glDepthRange function ?

    Documentations say that, glDepthRange defines the mapping of normalized device coordinates (range [-1, 1]) with the window-space Z coordinate ranges from [0, 1]. -1 is mapped to near values and 1 in mapped to far value.

    But, what exactly is the use of this ? if I give glDepthRange(0.4,0.6), will it cause clipping of the graphics ? (I tried this but did not see any impact). Also, how is it different from the last two parameters of glOrtho function ?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    This is purely a mapping function it does not effect anything except the value stored in the z-buffer. Normally it is 0-1. I can see no reason to change this since any smaller range will only serve to increase z-buffer fighting. It does not cause any sort of clipping. Do not confuse this with the near and far clipping planes of glOrtho which define how to convert from camera space to NDC

  3. #3
    Newbie Newbie
    Join Date
    Dec 2012
    Thanks tonyo_au. I also believed the same, but was wondering, why at all this API has been provided, if it does not impact anything. Hence thought of posting the question.

    While going through some documentation on web, I found that, in olden days, when system processing power was low, graphics developers were using half depth buffer alternatively for successive frame(ie 0.0 - 0.5 for 1st frame and 0.5-1.0 for the next). This would allow them to wok without clearing the depth buffer, hence improving performance.

    Thanks for the quick reply and clarifying my doubts.

Posting Permissions

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