Code: Select all
#include <irrlicht.h>
#include "driverChoice.h"
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
int main()
{
video::E_DRIVER_TYPE driverType=driverChoiceConsole();
if (driverType==video::EDT_COUNT)
return 1;
// create device and exit if creation failed
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<u32>(640, 480),
32, false, false);
if (device == 0)
return 1; // could not create selected driver.
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
// create render target
video::ITexture* rt = 0;
rt = driver->addRenderTargetTexture(core::dimension2d<u32>(256,256), "RTT1");
driver->beginScene(true, true, 0);
if (rt)
{
driver->setRenderTarget(rt, true, true, video::SColor(0, 255, 255, 255));
u32* ImgTemp = (u32*)rt->lock();
driver->draw2DLine(core::position2d<s32>(0,0), core::position2d<s32>(256,256), video::SColor(255,0,0,0));
video::IImage *image = driver->createImageFromData(rt->getColorFormat(), rt->getSize(), ImgTemp);
driver->writeImageToFile(image, "result.bmp");
image->drop();
rt->unlock();
}
driver->endScene();
device->drop(); // drop device
return 0;
}
With OpenGL or Burning's video driver I see only background. I can see the line with the basic software renderer. I have not tested with directx.
Is there mention of this in the docs? Is there a workaround. Searching the forum tends to show up long lists of old threads without mention of resolution. I believed this to be the texture flip problem, but if it were simply vertically flipped I might expect to see the line traveling in the opposite direction but I do not see it at all.
It seems like something which should be mentioned in the RTT tutorial,at least, as debugging this without knowing the cause is time consuming.
Thanks.
