As we know, glReadPixels()
will block the pipeline and use CPU to convert data format, especially when I want to read depth value out to system RAM.
I tried PBO provided by Songho, but I found it was only useful when param of glReadPixels()
was set to GL_BGRA.
- When I use PBO with param
GL_BGRA
, the read time is almost 0.1ms and CPU usage is 4%. - When I change param to
GL_RGBA
, it reads 2ms with CPU usage 50%.
It is the same when I try GL_DEPTH_COMPONENT
. Apparently the slowness is caused by converting, so any one knows how to stop it converting data format?
In my program, I have to read depth value and calculate 16*25 times in less one second, so 2ms is not acceptable.