Page 1 of 1

ITexture alpha

Posted: Sun Feb 12, 2006 11:39 am
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?

Posted: Sun Feb 12, 2006 1:32 pm
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)

:)

The harder one

Posted: Sun Feb 12, 2006 3:48 pm
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