Re: advice and/or help on glReadPixels



jbw:

I could not see any "BRGA" in the documentation. I assume you mean
"RGBA" ??

I tried this on my computer and got the same dismal results. Actually
it took slightly longer than RGB but I think that is due to being in a
loop slightly longer to look for red bytes. After all there are width
X height X 4 bytes for this case.

I am in TrueColor mode. Is it possible that some cards are not
optimized for efficient reads? I.e. might my card not take advantage of
the fact that I am requesting 4 bytes and it's TrueColor and do some
sort of byte-moving loops anyhow?

Thanks again,

Dave
jbwest wrote:
> "drawing in aspnet" <csharpuser@xxxxxxxxxxx> wrote in message
> news:1138641677.920635.322190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >
> > psvalins@xxxxxxxxx wrote:
> >> a) Try reading the entire RGB instead of just the red. Do your counts
> >> in the cpu.
> >> Also try different formats to check what your hardware likes.
> >>
> >> b)Check if your card supports pixel buffer extension. If yes then you
> >> could try
> >> asynchronous reading. The extension registry has exact details as to
> >> how you
> >> could do this.
> >>
> >> c)If your card supports arb_imaging then you could also try histograms
> >> and sink
> >> them.
> >>
> >> d)Rendering to a texture using render to texture extension could also
> >> be faster than
> >> reading from framebuffers.
> >
> > Thanks for all the advice. I should have mentioned in my first posting
> > that I had tried reading all of RGB before. In fact the result was
> > slightly worse, 12 seconds versus 10.6. Quite possibly, it's exactly
> > the same time and the difference is the time spent looping through all
> > the pixel data and filtering the red ones.
> >
> > Curiously, I ran the program on a friends computer and improved the
> > performance by a factor of 8 (1.3 seconds total). So, I suspect there
> > is great variability on how well different graphics cards do a
> > "ReadPixels". The extensions you mentioned are not available on my
> > card (Intel 915G, GL Version 1.4.0), but quite possibly they are
> > available on another.
> >
> > Thanks again.
> >
> > Dave.
> >
>
> Still very dreadful performance -- did you use BRGA format ? (not RGB, but
> actually BRGA). The Framebuffer is (if in true color mode -- you are in true
> color mode, "16million colors" aren't you?) actually packed that way, so
> that an unsigned byte BGRA read doesn't have to go thru nasty byte-moving
> loops. Ditto on your side, a quick integer loop with a mask & shift is
> probably phenominally faster than byte moves.
>
> jbw

.



Relevant Pages

  • Re: Problem with a script
    ... a loop there becomes impractical. ... You still have them as uniquely named array indexes... ... writing the code twice will only ... reading your entire code and parsing it in their head, ...
    (comp.lang.php)
  • Re: Problem with a script
    ... Okay, so variables have unique labels, that doesn't mean they still couldn't be handled in a loop. ... You still have them as uniquely named array indexes... ... I believe that for the new guy this code would be readable, and identifying problems should really not be any more difficult with this, plus I think that it actually might save some time to write the actual code from the beginnig, even though it's not at it's final stage, instead of first writing everything spread out, and then rewriting the same code again cleaned. ... If you expect a person to spend an hour reading your entire code and parsing it in their head, you wont get any help and have to solve the problem by yourself. ...
    (comp.lang.php)
  • Re: Ousting loop
    ... conversations around this absolutely insane deck concept. ... Btw, guys, I found one card that makes the setup SLIGHTLY ... special allows you to create an endless loop with two combat cards. ...
    (rec.games.trading-cards.jyhad)
  • Re: Thread stolen from rasfw; Magic and Society
    ... "The cards have no power in themselves and do not foretell the ... desires, fears, etc. -- than the original reading. ... what's on your mind beforehand because I don't want to know. ... given the feedback I get from return querants). ...
    (rec.arts.sf.composition)
  • Re: SnG Strategy Party
    ... I have started reading it. ... >> somehow learn to play without cards and increase my winnings. ... I think poker tracker says you have to say yes to the 'do ...
    (rec.gambling.poker)