Hello, I was wondering if glReadPixels works with an fbo.
In my program, during typical operation, the user clicks on the terrain background and I use gluUnProject in combination with glReadPixels to get 3d coordinates.
In a new situation, I draw the scene to an offscreen fbo with a color and depth texture rectangle attachment. I render the fbo as a texture with a polygon to the standard draw buffer. ( similar to the example with the fbo class from gpgpu.org ) Problem is, the depth does not copy … well its just the depth of the single polygon with the texture. Thus, glReadPixels is going to read the wrong depth. Now when the user clicks I get bad behavior.
My motivating factor to draw into the fbo is to down sample from a larger buffer into a smaller buffer and get anti aliasing or maybe implement a Gaussian filter. I’d assume the size of the fbo should be 2x of the default draw buffer?
I suppose either I can copy this depth somehow or have glReadPixels work on the fbo’s depth texture?