Reputation: 347
I need to draw N passes, for each pass, I read one pixel from fbo, and I find that it's too slow to read one pixel for each pass. And then, I use another texture(rectange:N*1) to cache the pixel, which means that for each pass, I copy one pixel to the result texture. After N passes, I read the result texture once. However, it also TOO SLOW. for example, to read the result texture (200*1), it costed 13 ms.
I am wondering if there's another way to solve this problem.
I also solved some posts about pixel buffer object, which works in asynchronous way.However, after the last pass done, I need the result from the result texture at once.No other works for both cpu and gpu.
Upvotes: 0
Views: 1204
Reputation: 45322
As you already found out, it is slow due to the implicit synchronisation that has to be done for your ReadPixels. If you cannot work asynchronously, you have to live with the poor performance. You simply cannot read back data which is not yet written, and have to wait for the GPU in this case. Without further knowledge of the task you are trying to solve, it is not possible to make any specific suggestions how performance can still be improved.
Upvotes: 2