Initialize once (Out of loop):
Code: Select all
video::ITexture* rt = 0;
rt = driver->createRenderTargetTexture(core::dimension2d<s32>(800,800));
Code: Select all
while(device->run()){
driver->beginScene(true, true, video::SColor(0,0,0,100));
driver->setRenderTarget(rt, true, true, video::SColor(0,0,0,255));
smgr->drawAll();
driver->setRenderTarget(0);
SColor tmpColors[4];
SColor tColor(128,128,0,0);
tmpColors[0] = tColor;
tmpColors[1] = tColor;
tmpColors[2] = tColor;
tmpColors[3] = tColor;
smgr->drawAll();
driver->draw2DImage(rt,rect<s32>(0,0,800,600),rect<s32>(0,0,800,800),0,tmpColors,true);
driver->draw2DImage(rt,rect<s32>(0,0,800,600),rect<s32>(0,0,800,800),0,tmpColors,true);
driver->endScene();
}