Ok, I tried to add post effects as described http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=13437 here. I now have it but I want to add post effects object based. So I created two RTT textures and rendered the effects I want with the object I want on that two different textures (name it itex1 and itex2
So now I want to add these two textures itex1+itex2, since I found no function for that I wrote one on my own.
Code: Select all
static void AddTextures(Irrlicht::Video::ITexture* a, Irrlicht::Video::ITexture* b)
{
irr::video::ITexture* aa = a->get_NativeTexture();
irr::video::ITexture* bb = b->get_NativeTexture();
// aa will be the output texture
// assume both textures have the same format! color and size!
irr::core::dimension2d<irr::s32> dim = aa->getOriginalSize();
irr::s32 pitch = aa->getPitch() / 2;
irr::s16 *pa = (irr::s16*) aa->lock();
irr::s16 *pb = (irr::s16*) bb->lock();
for(int x = 0; x < dim.Width; x++)
{
for(int y = 0; y < dim.Height; y++)
{
pa[y* pitch + x] = pa[y*pitch+x] + pb[y*pitch+x];
}
}
aa->unlock();
bb->unlock();
}
Which doesn't function, because it can not get lock on textures whiche are created with the createRenterTargetTexture function. But after applying the patch mentioned here http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=10154, Irrlicht can get lock on the both textures.
So now my two problems:
- aa->getPitch() returns zero, anybody know why? (texture created with the createRenterTargetTexture function)
- The image looks bad (see below). I set the size of the itex1 and itex2 textures the same size as the output window does have.

(Rendered with DirectX9)