I use IMeshSceneNode to load a model and use function drawVertexPrimitiveList() in another ISceneNode named CRingSceneNode to draw a circle around the model. It works when rendering in main scene. But when I try to save it in a image, the circle seems always to be always on top.
These two sceneNode are managed by another node named CMainSceneNode and I invoke saveToFile function once to save the main scene in OnAnimate().
CRingSceneNode is set to be ESNRP_TRANSPARENT_EFFECT and material is EMT_TRANSPARENT_VERTEX_ALPHA. IMeshSceneNode's material is set to EMT_TRANSPARENT_ALPHA_CHANNEL_REF. (I tried EMT_SOLID but also didn't work.)
Code: Select all
int CMainSceneNode::saveToFile()
{
irr::video::IVideoDriver* driver = getSceneManager()->getVideoDriver();
irr::scene::ISceneManager* smgr = getSceneManager();
rt = driver->addRenderTargetTexture(core::dimension2d<u32>(750, 1108), "RTT1");
irr::core::rect<s32> preView = driver->getViewPort();
driver->setRenderTarget(rt, true, true, video::SColor(0, 0, 0, 255));
driver->setViewPort(recti(0, 0, 750, 1108));
m_sceneMgr->drawAll();
driver->setRenderTarget(0, true, true, 0);
driver->setViewPort(preView);
IImage* image = driver->createImage(rt, irr::core::vector2d<irr::s32>(0, 0), irr::core::dimension2d<irr::u32>(750, 1108));
driver->writeImageToFile(image, "a.png");
return 1;
}