16bit Bitmap Transparency

Post Reply
habababa
Posts: 4
Joined: Mon Jan 24, 2011 6:17 am

16bit Bitmap Transparency

Post by habababa » Mon Jan 31, 2011 6:30 am

How do I set a certain color like black to be transparent with a 16bit Bitmap?
Do I use GL_TEXTURE_COLOR0_TRANSPARENT?
There's no example that illustrates this in the libnds examples folder.

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: 16bit Bitmap Transparency

Post by elhobbs » Mon Jan 31, 2011 2:23 pm

GL_TEXTURE_COLOR0_TRANSPARENT is for paletted textures only. for 16bit texture formats you need to use the alpha bit - bit 15.

habababa
Posts: 4
Joined: Mon Jan 24, 2011 6:17 am

Re: 16bit Bitmap Transparency

Post by habababa » Fri Feb 04, 2011 7:55 am

OK thanks.
So I need to add a certain parameter to my *.grit file for the alpha bit?

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: 16bit Bitmap Transparency

Post by zeromus » Sat Feb 05, 2011 10:20 am

have you tried putting an alpha channel in your source images? have you tried looking at the grit options such as

-gT{n} Transparent color; rrggbb hex or 16bit BGR hex [FF00FF]

which seem to describe what you want?

Rexhunter99
Posts: 23
Joined: Thu Sep 09, 2010 1:28 pm
Location: Australia
Contact:

Re: 16bit Bitmap Transparency

Post by Rexhunter99 » Thu Feb 10, 2011 8:58 am

habababa wrote:How do I set a certain color like black to be transparent with a 16bit Bitmap?
Do I use GL_TEXTURE_COLOR0_TRANSPARENT?
There's no example that illustrates this in the libnds examples folder.
So you want ColourKey transparency? so basically:
A = 0 = RGB(0,0,0)
Where Alpha is equal to 0 if the RGB components are all 0 (black)
You can loop through your texture bitmap array and process each 16-bit value, if the RGB bits are all 0 then you can set bit 15 to 0 otherwise bit 15 would be 1
Move over Mario... and cruise by Crash... Croc Rocks!
It's a serious adventure 3D platformer for all retro gamers to drool over =D

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests