glReadPixels and SDL double buffering

It’s the first time I’m trying to use OpenGL’s glReadPixels to make a screen
capture on the back buffer and store the RGB values in a array. Problem is
that the colors are stored wrong, the image looks too greenish. I’m using
SDL for video in dubbel buffering mode. Could this has something to do with
that? I tried to solve this problem in many ways but I cannot find the bug
and I’m getting desperate :frowning:

Peter

A known bug with the 3dfx/Glide implementation is that glReadPixels tends
to return values in BGR format, even if you asked for RGB. We first
discovered this “feature” in GLQuake, which happens to ReadPixels the
screen in RGB mode and then flip bytes around to save a Targa since it
only had OpenGL 1.1 available at the time. We fixed that symptom by
always asking for GL_BGR (we require OpenGL 1.2) and removign the byte
frobbing loop.

These kinds of problems will always exist until someone manages to write
an extension which allows you to glDisable (GL_DRIVER_BUGS).On Mon, Dec 10, 2001 at 09:41:03PM -0800, Peter Venis wrote:

It’s the first time I’m trying to use OpenGL’s glReadPixels to make a screen
capture on the back buffer and store the RGB values in a array. Problem is
that the colors are stored wrong, the image looks too greenish. I’m using
SDL for video in dubbel buffering mode. Could this has something to do with
that? I tried to solve this problem in many ways but I cannot find the bug
and I’m getting desperate :frowning:


Joseph Carter Free software developer

!netgod:! time flies when youre using linux
!doogie:
! yeah, infinite loops in 5 seconds.
!Teknix:! has anyone re-tested that with 2.2.x ?
!netgod:
! yeah, 4 seconds now

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011210/6295bfc1/attachment.pgp

Sorry for not fully understanding this, but could you please explain me what
’removing the byte frobbing loop’ means?

Thanks for your answer,

Peter>A known bug with the 3dfx/Glide implementation is that glReadPixels tends

to return values in BGR format, even if you asked for RGB. We first
discovered this “feature” in GLQuake, which happens to ReadPixels the
screen in RGB mode and then flip bytes around to save a Targa since it
only had OpenGL 1.1 available at the time. We fixed that symptom by
always asking for GL_BGR (we require OpenGL 1.2) and removign the byte
frobbing loop.

Hrmm…I didn’t change that section of twilight, but I would guess it has
something to do with byte-swapping the BGR to RGBA and so forth…On Tue, Dec 11, 2001 at 02:00:43PM -0800, Peter Venis wrote:

Sorry for not fully understanding this, but could you please explain me what
’removing the byte frobbing loop’ means?

Quake used to ask for GL_RGB and then convert by hand with a loop to
GL_BGR (which wasn’t standard till OpenGL 1.2)… Since we ask for it in
GL_BGR now, we have no need of the loop.On Tue, Dec 11, 2001 at 02:00:43PM -0800, Peter Venis wrote:

Sorry for not fully understanding this, but could you please explain me what
’removing the byte frobbing loop’ means?


Joseph Carter Free software developer

gcc is the best compressor ever ported to linux. it can turn
12MB of kernel source (and that’s .debbed) into a 500k kernel

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20011211/771cbaf1/attachment.pgp

Hello again–

I got asked whether my SDL trivia game could be ported to the Playstation

  1. As someone who’s only toyed with some Playstation demos, I said,
    ermmm, probably. I’m using the video & audio components of SDL, as well
    as SDL_TTF, SDL_mixer and libtiff for loading graphics. SDL_mixer is
    trivially replaceable since all I do is start and stop sounds. libtiff
    too, since presumably I’ll convert all my graphics to the Playstation’s
    path-of-least-resistance graphics format as part of the build process.
    The Truetype fonts part will probably just want some pre-converting to
    bitmaps too, since that sounds like an extravagence for a Playstation.
    The only bit that concerns me after that is SDL-- is there a neat mapping
    from SDL’s semantics to those used by the Playstation’s graphics unit?
    Likewise for audio. And has somebody gone to the effort of doing such a
    port?

Also, I’m planning on gathering together some more questions for the SDL
FAQ, or at least my own hints-and-tips page, since I’ve asked quite a few
basic questions here in the last few months, and I’ve seen a few other
people respond to questions with Oh No, Not Again! The current FAQ gets
you being able to build stuff, but not much more; I’m interested in
putting together a page explaining strange behaviour and some of the
mysteries I’ve encountered over the last couple of months while learning
to work with SDL. So if you’ve been on the list a while and have any
howlers to contribute, I’d be very grateful to have any canned responses
you’ve given over the years. Meanwhile I’ll comb the mailing list for
questions and answers, and try to put something together before the new
year.

cheers,–
Matthew > http://www.soup-kitchen.net/
> ICQ 19482073