   Problem with reading depth buffer
  Hi there,I am trying to use glReadPixels to read pixel depth from depth buffer:GLfloat *pointDepth = new GLfloat;...glReadPixels(x,y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, pointDepth);...but almost in all points read the same depth 0.50000006. I am using a Dell laptop with NVIDIA GeForce 8400M GS display adapter.I do appreciate if somebody can help on this. I have spent almost all the day to fix this but I could not.Thanks   
  Well for 1, what is your scene.2.) Why dont you actually read the whole scene;GLfloat *pointDepth = new GLfloat[width*height];Then copy all of them.   ;Quote:Original post by hazariGLfloat *pointDepth = new GLfloat;glReadPixels(x,y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, pointDepth);I would avoid the allocation, and just pass the address of a float variable on the stack. As to your problem, make sure that your context owns the pixel you are trying to read back (pixel ownership is not entirely straightforward), and also remember that the OpenGL coordinate system is upside down, so you may need to flip your y coordinate.   ;  Thanks for your comments. But I think I found the reason for  problem. I use glDrawPixels function before glReadPixles. That is why I have same point depth in almost all pixels.