How to visualize a depth texture in OpenGL?

前端 未结 3 1098
面向向阳花
面向向阳花 2021-02-11 01:52

I\'m working on a shadow mapping algorithm, and I\'d like to debug the depth map that it\'s generating on its first pass. However, depth textures don\'t seem to render properly

3条回答
  •  借酒劲吻你
    2021-02-11 02:05

    Sure, just bind your depth texture to your favourite texture unit, enable texturing, and draw a 2D quad! You could also size the quad to only fill part of the screen so that you can view the shadowmap in realtime.

    OpenGL also has functions which can copy the texture into an array for you. You could save this as an image and use an image viewer to view it.

提交回复
热议问题