1

I am willing to run two separate Irrlicht devices, basically a new one after the old one is closed, but by using the two above mentioned methods to close the old one I cannot get the new device to appear (segfault). What is the correct way of doing that?

ouphi
  • 232
  • 2
  • 9

2 Answers2

3

Just for the clarification.

All the closeDevice() does is just tell Irrlicht to return false on next run() call. It is safe to call it from any part of your code (from the event handler or in the middle of the drawing geometry). Basically you can make your own variable to hold the flag like needBreakRenderingLoop and ignore what run() returns, instead check your variable and change it manually instead of calling closeDevice(). But that is done by the engine already for you.

1

To fully close a device in a clean way, you must call closeDevice(), then run() to clear all the late events then drop() to clear the memory. So basically do the following:

device->closeDevice();
device->run();
device->drop();
Valentin Mercier
  • 5,256
  • 3
  • 26
  • 50