method2 and method3 use PBO to do asynchronous download,so I think they are better than method1(my test also prove it),but between method2 & method3,which is the best?
As yooyo already hinted, you won’t see a performance gain with your code, because there is no parallelism. It is true that in your second method the ReadPixels starts asynchronously, but calling MapBuffer immediately therafter blocks the CPU till the read is complete. Similar, in the third method the rendering of the scene will have to wait till the read operation is complete. Either you use two rendering targets as yooyo suggested or introduce some heavy CPU work in your method2: (insert SomeHeavyCPUCode() betweed ReadPixels and MapBuffer)
I think I should explain a fact : the “RenderFunc()” is called every 80ms,so in method2 there is no wait to do because pbo0 & pbo1 are mapped every 80ms,in 80ms download operation should be complete;in method3 “RenderScene()” call will host 5-6ms,so it is the “HeavyCPUCode”?
It is very stange,in my machine,I found method3 is the best one,and I found the key is the “glReadPixels()” call;In method2,If the “RenderScene()” is not a heavy work,“glReadPixels()” return immediatly,but if it is “glReadPixels()” will host 5ms,in method3,“glReadPixel()” all return immediatly;It is strange,who can explain it ?