I am trying to implement an app using Image Based Rendering (IBR) technique. At the very beginning stage, I try to get depth info from frame buffer. Here is a piece of code that I used to obtain depth info:
GLfloat* depth= new GLfloat[nWidth * nHeight];
glReadPixels(0, 0, nWidth, nHeight, GL_DEPTH_COMPONENT, GL_FLOAT, depth);
The result ends up looking pretty weird when I print it out.
for (int i = 0; i < nHeight * nWidth; i++)
cout << depth << " ";
depth (i = 0, 1, 2,...) have the same value 1. Can someone give me an explaination?
Thanks in advance