PDA

View Full Version : RGBA or BGRA ?



Osku
11-21-2000, 02:37 PM
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

Deiussum
11-21-2000, 03:18 PM
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.

Moz
11-22-2000, 01:01 AM
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).

Osku
11-22-2000, 05:46 AM
Ok thanks guys, what about the screen? Can the framebuffer 'physically' be stored in BGRA-order?

Cheers Osku

Deiussum
11-22-2000, 06:17 AM
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.