[squeak-dev] Re: Still pounding head against wall over glReadPixels => external buffer

Josh Gargus josh at schwa.ca
Fri Feb 12 19:24:52 UTC 2010


On Feb 11, 2010, at 10:33 PM, Lawson English wrote:

> Lawson English wrote:
>> Josh Gargus wrote:
>>> Very cool, nice work!
>>> 
>>> If it turns out that you need more CPU cycles, you might try using PBOs to asynchronously read the pixels... when you call glReadPixels(), the function does not return until the pixels have been completely read, and while you're waiting for the pixels to cross the PCI-E bus, Squeak isn't doing any processing.  If you're reading back 30fps at 5ms per frame (according to your measurements below), you're sitting idle about 15% of the time.
>>> 
>>> Search for "Asynchronous glReadPixels:" in the PBO extension spec (http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt).  Google will turn up many more tutorials.
>>> 
>>> It probably won't be your top priority right now, but I wanted to ensure that you're aware of the option.
>>> 
>>> Cheers,
>>> Josh
>>> 
>>>  
>> 
>> Thanks. I was aware of PBOs and the like but didn't want to get into them until I got something simple working.


Always the right way to proceed.


>> Am I misunderstanding 1000x1000x1000x4/6?


I'm not sure what you mean by this.  Maybe what I write below will clear up your question.


>> 
>> I get more like 160fps x 1megapixel raw blitting speed which sounds fast until one realizes that not much else is going on period.
> 
> doh 160 MB/sec ~ 30fps, like you said. LOL


Ha ha, only by pure coincidence.  I picked a "typical" frame rate out of the air (maybe your app would require 60fps, or maybe only 15fps); to be more clear, I should have written "If you're reading back, say, 30fps...".  

By your measurements it takes about 5ms to read back a frame, so if you read back 30 every second it will take about 150ms just waiting on glReadPixels.  That's 15% of your time (30% at 60fps, and 7.5% at 15fps).

Cheers,
Josh




More information about the Squeak-dev mailing list