1

I am able to render depth maps of 3d models to the screen using openGL. I am trying to obtain a 2d array (or matrix) representation of the depth map, say as a grayscale image, so I can perform image processing operations on it, like masking and segmentation.

So far, my depth map simply prints depth values instead of the colors in the fragment shader. How can I save the resulting depth map display as a matrix?

user308485
  • 611
  • 1
  • 5
  • 25
  • 2
    Possible duplicate of [How to use GLUT/OpenGL to render to a file?](https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file) – Nico Schertler Oct 31 '17 at 10:58
  • I noticed that you have been asking quite a few questions in the past days. Most of them have been closed or down-voted. I highly encourage you to read [ask] and to do some more extensive research before posting questions. If you keep posting badly received questions, you might come close to a question ban. – Nico Schertler Oct 31 '17 at 11:02

1 Answers1

0

You have to use frame buffer object. Attach texture to it as a depth attachment, and then use as normal texture. Have a look at this tutorial for example.

Jeka
  • 1,364
  • 17
  • 33