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?