I just started using irrlicht, and everything worked like a charm in the beginning. But now I'm getting segfault all over the place. I shrinked my app to a few lines of code, and it still fails:
Code: Select all
int main(int argc, char *argv[])
{
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>( 640, 480 ), 16, false, false, true, 0 );
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
// add camera
CameraController* cameraController =
new CameraController( smgr, vector3df(1900*2,900*2,3700*2), vector3df(1900*2,300*2,3400*2), 1 );
// create event receivers
GlobalEventReceiver globalEvents( device );
globalEvents.addEventReceiver( cameraController );
device->setEventReceiver( &globalEvents );
int lastFPS = -1;
while( device->run() )
{
driver->beginScene(true, true, SColor(0,200,200,200));
[color=red]smgr->drawAll();[/color]
guienv->drawAll();
cameraController->updateCamera();
driver->endScene();
// display frames per second in window title
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str
= L"Terrain Renderer - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
guienv->addStaticText( str.c_str(), rect<s32>( 500, 10, 200, 175 ), true, true, 0, -1, true );
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
}
The segfault occurs at CSceneManager::drawAll(). I'm (yet) not intelligent enough to track it down to the exact line of code.
Any ideas?