View Full Version : Which is the FASTEST way to read A pixel from Texture/Framebuffer
09-04-2007, 09:58 PM
Hi everyone !
I am write a program, need to read back only several pixels from a render target texture attached on a FBO.
So which is the best way to do this ? Because I only need very few pixels, so I think if I use PBO or ReadBack mode will caused more delay than directly calling glReadPixels. Am I right ?
Thanks very much.
09-04-2007, 11:38 PM
There is no "fastest" way. There are only varying degrees of slow ways. What you're doing is inherently slow and will force a full pipeline flush.
Using PBO with glReadPixels will (or should) always provide the theoretical maximum readback speed, since it does not stall the pipeline.
09-05-2007, 07:33 AM
Also note that the fixed cost of an individual glReadPixels is very high, so it depending on how many pixels you need exactly and how these pixels are located, it might be a lot faster to just read a bounding rectangle or even the full framebuffer than multiple single-pixel-reads...
09-06-2007, 07:18 AM
You need to define "fastest". Do you mean "lowest latency" or "least effect on FPS" or "lowest CPU consumption". Korval answered for "least effect on FPS" and "lowest CPU consumption" but you reference to "more delay" implied you may have desired "lowest latency".
If you need a gather operation as implied by "few pixels" then consider a second pass that packs the pixels into another FBO so that they can be read with a single glReadPixels call. This will avoid the problem addressed by Overmind.
Knight Chat X
09-24-2007, 11:27 PM
Multiple threads reading specific areas of an image at sametime??
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.