glDrawPixels() with Alpha Channel

This will be a really newbie post; I’m just looking for general direction/advice.

I want to draw a 32-bit bitmap with a format like ARGB (A8 R8 B8 G8). In glDrawPixels there is no GL_ARGB format , but I see a GL_UNSIGNED_INT_8_8_8_8 type option.

What’s the simplest way to do this? Is there some way to convert from ARGB to RGBA, either in OpenGL or with a specific image editor? (I’m pretty sure DirectX has functions for this type of situation).

Thanks!

The documentation says there is GL_RGBA. So you’ll have change your format in memory from ARGB.

http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html

I realize there is an RGBA and no ARGB… I was just wondering if OpenGL has built-in functions to convert, since I recall that DirectX can convert from BGR to RGB and back.

Otherwise I was asking if someone happens to know an easy way to convert (perhaps an image editor that can save different forms of 32bit bmp’s???). I can write a program that will go through my bitmaps and swap the two, but I have many bitmaps in a folder and this seems like a lot of work.

Do you have a reason to use drawpixels and not a textured quad ?
Textures can be BGRA and have much better performance.

BTW I had never heard of ARGB :
http://www.eggheadcafe.com/conversation.aspx?messageid=31709431&threadid=31709428

Yea I’m realizing that ARGB is a non-existent format, but I acquired these bitmaps in a very strange way (they were custom created by a friend who was doing graphics rendering using an old MC68k processor… long story…)

Anyway, I managed to write a program to convert them so no worries. Thanks for your help.

ARGB (BGRA backwards) seems to be an old DX9 convention for representing little-endian byte orders in a hexadecimal layout (i.e. 0xAARRGGBB). As Zbuffer pointed out GL_BGRA is just the ticket for bitmap layouts.