tksuoran
11-01-2010, 03:57 PM
Is there a portable way to read depth buffer values with glReadPixels()?
I have tried the following (using OpenTK bindings)
GL.ReadPixels<uint>(px, py, 1, 1, PixelFormat.DepthComponent, PixelType.UnsignedInt, depthsi);
GL.ReadPixels<float>(px, py, 1, 1, PixelFormat.DepthComponent, PixelType.Float, depthsf);
Both of these work on NVidia. Unfortunately on AMD the first one only gives me 0 and the second gives me INVALID_OPERATION. Querying the framebuffer attachment says the depth attachment has float component type.
I have tried the following (using OpenTK bindings)
GL.ReadPixels<uint>(px, py, 1, 1, PixelFormat.DepthComponent, PixelType.UnsignedInt, depthsi);
GL.ReadPixels<float>(px, py, 1, 1, PixelFormat.DepthComponent, PixelType.Float, depthsf);
Both of these work on NVidia. Unfortunately on AMD the first one only gives me 0 and the second gives me INVALID_OPERATION. Querying the framebuffer attachment says the depth attachment has float component type.