ITexture alpha

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.
Post Reply
Guest

ITexture alpha

Post by Guest »

Hello everyone.

I wnould like to know if there is anyway to set an alpha value to all pixels from an ITexture object?
RadBrad
Posts: 2
Joined: Sun Feb 12, 2006 1:27 pm

Post by RadBrad »

I think...

Code: Select all

irr::video::ITexture::getAlpha(s16 color); 
So...

Code: Select all

ITexture->getAlpha(s16 color);
(make sure you have namespaces turned on in your program header)

:)
neotoma
Posts: 10
Joined: Tue Mar 29, 2005 9:49 am
Location: Germany
Contact:

The harder one

Post by neotoma »

You can set the Alpha-Value directly.
Use the lock(-method on texture to get the Pointer to the Texture-Data (the Image). And if you use 32-Bit as default-Texture creation, you can set the Alpha-Value as a Byte.

example (not tested):

Code: Select all

unsigned char* pData = texture->lock();
s32 offset = (y*texture->getPitch())+(x*4);
(pData+offset)[3] = newAlphaByte;
texture->unlock()
Mike
Post Reply