I have a big terrain that made up into many triangles, and have a FPS camera used for walk into terrain, and have another camera fixed above terrain used for RTT(render to texture). the RTT has been pasted into screen.
I want to RTT's background is full transparent, so using:
video::IVideoDriver::makeColorKeyTexture(...) and video::draw2DImage(...) to paste to screen. like this:
video::ITexture *m_pRTT=m_pDriver->addRenderTargetTexture(core::dimension2du(512,512),"RTT1",video::ECF_A8R8G8B8);
... ...
while(p_pDevice->run())
{
m_pDriver->setRenderTarget(m_pRTT, true, true, video::SColor(0,0,0,255));
... ...
m_pDriver->makeColorKeyTexture(m_pRTT,video::SColor(0,0,0,255),true);
m_pDriver->draw2DImage(m_pRTT,core::vector2di(1,1),core::recti(0,0,512,512),0,video::SColor(255,255,255,255),true);
}
But when program runs for a while, it automaticly exit, I have traced and found "makeColorKeyTexture" function cause memory's usage quickly increased and result to program exit. Also, the finally RTT texture does not any transparent or full transparent (change last param of draw2DImage function). (The render driver for D3D9 and OpenGL both have this probelm).
So How to process this problem, and sorry for my poor english.
thanks.