Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 15 Nov 2012
Offline Last Active Nov 17 2012 08:07 AM

Topics I've Started

Separating bitmap color channels?

15 November 2012 - 12:48 PM

Using OpenGL ES 1.x, I have some bitmapped graphics that really only need one 8-bit color channel (256 levels) and I want to be able to draw them to the display in any color I want. For example, right now they're RGB images colored white, and I draw them with a color mask to get them on ths display in the appropriate color -- mostly I use this for text.

Having these loaded into 3-channel (RGB) 24-bit bitmaps is very wasteful -- it uses 3x the memory it really needs to. Is there a way to load these in as single-channel bitmaps (1 byte per pixel) and then when they're drawn, have them use the desired color?

Alternatively, is there a way to use, say, just the red channel out of a source bitmap and then draw it to the screen in any desired color? My thought here is that I could get triple-duty out of a loaded bitmap, with separate 8-bit images loaded into each of the R, G and B channels -- and then when I want to use those bitmaps, I'd just use one of the channels as a source then draw it in the desired color. Again, this would save memory because three of these 8-bit bitmaps would fit into a 24-bit loaded bitmap. Is there a way to pull this off? Some of these bitmaps are pretty large and use a lot of memory and I'd like to reduce the memory footprint.

I hope this makes sense to you, and I'd appreciate some tips or suggestions. Thanks!