2D image transparency?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
soconne
Posts: 87
Joined: Fri Mar 05, 2004 2:00 pm

Post by soconne »

Well what about having transparency on a 3d triangle? I'm having a problem trying to load a texturemap and have an alpha component at the same time. I tried what was stated above, loading a 32-bit tga file from photoshop, but the alpha channel wasn't loaded. I'm trying to blend a 3d triangle based on the alpha value in the texture map, but can't seem to get the alpha component to work. Is there a built in function in Irrlicht that lets you 'add' the alpha channel to an existing texture image once its been loaded??
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

Post by rt »

soconne wrote:Well what about having transparency on a 3d triangle? I'm having a problem trying to load a texturemap and have an alpha component at the same time. I tried what was stated above, loading a 32-bit tga file from photoshop, but the alpha channel wasn't loaded. I'm trying to blend a 3d triangle based on the alpha value in the texture map, but can't seem to get the alpha component to work. Is there a built in function in Irrlicht that lets you 'add' the alpha channel to an existing texture image once its been loaded??
once the texture is loaded you can get a pointer to the image data via

Code: Select all

DWORD* pPixel = (DWORD*)image->lock();   // Get the pointer to the surface 
the pixel is 32bits, 0xAARRGGBB so you can strip off the alpha like so

Code: Select all

BYTE alpha = ((*pPixel) >> 24);
check out the texture manipulation code in the avi reader thread http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=927, but make sure you have enabled alpha correctly by applying the fixed found in this thread http://irrlicht.sourceforge.net/phpBB2/ ... .php?t=517
Dark_Exodus
Posts: 23
Joined: Thu Jan 29, 2004 4:07 pm
Location: Birmingham, UK
Contact:

Post by Dark_Exodus »

Thanks for the help guys, i finally got that working. :D
Post Reply