I have to read color buffer and depth buffer every frame. I know the glReadPixels
function is very slow, so I would like to know if there is a faster way to do the reading.
If glReadPixels
isn't fast enough, you have a couple of options:
1) Whatever post processing you need to do, do on the GPU via glsl, OpenCL, CUDA, or some other GPGPU solution
2) Do an asynchronous PBO read back on one thread while you start processing the next frame on another thread
3) Optimize other stuff so that a slow read back doesn't hurt performance elsewhere