0

I am using freeglut, and have a simple 3-D model (it is just a cube) that I can display on my screen. I am trying to obtain the depth map of this cube given the current coordinates and orientation of the camera and display the depth map on some window.

Is this possible? If so, how?

user308485
  • 611
  • 1
  • 5
  • 25

1 Answers1

0

You can create Frame Buffer Object FBO and attach only depth texture to it. Now while rendering just bind this FBO and render. The depth texture attached toFBO will have depth values. Now Bind this texture and use function like glReadPixels and get data of attached texture in some buffer. Then using some library like SOIL you can save it to format you want like ong or jpeg.