RGBA or BGRA ?

Hello everyone.

What is the difference between BGRA and RGBA modes, other than the order. Is there any performance related reason to why I should use BGRA instead of RGBA ? Is this only for textures or can the screen also be in BGRA mode?

Thanks, Osku

Not sure about BGRA, but the BGR mode makes it easy to use raw data from BMP files, which store the data in that order. BMP files don’t have an alpha channel, though. I suppose that it might make it easier to add your own alpha values to a BMP after reading it in, though.

Actually, there is a bitmap format that supports an alpha channel, it’s the Targa bitmap format (.tga). It stores the pixel data in BGRA format. To store an alpha channel in a Targa bitmap, use an image processing application to add a mask to your image (I use Corel PhotoPaint). The mask is the alpha channel.
A Targa file has got a header of 18 bytes, (the 13th & 14th give the width of the image, the 15th and 16th give its height and the 17th the number of bits per pixel). After the header, the data is stored in BGRA mode (or BGR mode if there is no mask in the image)(go to NeHe’s tutorial 25 at http://nehe.gamedev.net/tutorials/lesson25.asp)..)

Ok thanks guys, what about the screen? Can the framebuffer ‘physically’ be stored in BGRA-order?

Cheers Osku

Thanks Moz. I’ll have to keep that in mind. It could come in handy sometime. I haven’t really looked at a lot of different image formats for texturing purposes yet.