Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
IrrlichtDevice *device;
IVideoDriver* driver;
ISceneManager* smgr;
void init()
{
driver = device->getVideoDriver();
smgr = device->getSceneManager();
smgr->loadScene("scenes/terrain.irr");
smgr->addCameraSceneNode(0, vector3df(0,330,40), vector3df(0,5,0));
}
int main()
{
device = createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16, false, false, false, 0);
init();
int k=0;
while(device->run())
{
k++;
if ( k%100 == 0 )
{
smgr->getMeshCache()->clear();
smgr->clear();
driver->removeAllTextures(); //crashing because of this line
init();
}
///////////////////
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
linux, irrlicht 1.5
gdb:
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7ab18e0 (LWP 22106)]
0x080ed281 in irr::video::COpenGLDriver::setTransform (this=0xa344b70, state=irr::video::ETS_TEXTURE_0, mat=@0x8318280) at COpenGLDriver.cpp:693
693 const bool isRTT = Material.getTexture(i) && Material.getTexture(i)->isRenderTarget();