1)non-power-of-two textures NOT supported
2)use setRenderTarget()
I think, perhaps, the following code is the cause.
CD3D9Driver.cpp:865: CD3D9Driver::setRenderTarget()
Code: Select all
CurrentRendertargetSize = tex->getSize()
Code: Select all
CurrentRendertargetSize = tex->getSize()
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
bool force_off_TEXTURENPOT = true;
IrrlichtDevice *device =
createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
IVideoDriver* driver = device->getVideoDriver();
if(force_off_TEXTURENPOT)
driver->disableFeature(EVDF_TEXTURE_NPOT);
if(driver->queryFeature(EVDF_TEXTURE_NPOT)) {
device->setWindowCaption(L"test : TEXTURE_NPOT(ON) + renderTarget + 2Ddraw");
}
else {
device->setWindowCaption(L"test : TEXTURE_NPOT(OFF) + renderTarget + 2Ddraw");
}
ITexture *rt0 = driver->addRenderTargetTexture(dimension2d<u32>(600,400)); //make RECTANGLE renderTargetTexture
if(!rt0) return 1;
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
//use rendertarget
driver->setRenderTarget(rt0,true,true,SColor(255,100,101,140));
driver->draw2DRectangle(SColor(0xffff0000) , rect<s32>(10,10,600-10,400-10)); //draw RECTANGLE RedBox
driver->setRenderTarget(0);
//
driver->draw2DImage(rt0,vector2d<s32>(0,0));
driver->endScene();
}
device->drop();
return 0;
}