Original Post
Hi guys, I'm trying to read the depth buffer and place that information in an array like this: GLfloat *depthBuff = new float[RESX*RESY]; glReadPixels(0,0, RESX,RESY, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuff ); If I process that array and place a GL_POINT vertex to every hit the ReadPixel has recorded, then I found back the image I read (I use gluUnProject). The problem is, when I zoom out the camera, I find out that ReadPixel has detected "valid" pixels where there were none. It always happenx at the very bounderies of the viewing frustum and on the near plane and far plane. I decided to write a file with the depthBuff array information and found out that while most of the depth value of the pixels are correctly recorded as 0 or 1 (non existant), a few ones are given values where there were nothing in view. I'm using glClearDepth(1.0f); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); and I have made my near and far plane very close to each other to get the most of depth precision. Is that a normal behavior? What would you suggest? Thanks jeff