Page 1 of 1

Change device settings at runtime

Posted: Sun Mar 08, 2009 10:16 pm
by Malebolge
Hello,

I have problems making another device at runtime. if i use drop (or not), it create another device. if i call close, the programe close. I know there is no way to change the device settings, but i can not destroy and create another either?

Code: Select all

IrrlichtDevice* pDevice; 

   pDevice = createDevice(EDT_DIRECT3D9, core::dimension2d<s32>(800,600), 32, true, true, true, &eventReceiver);
   pDevice->drop(); //i dont see any diference.
   pDevice->closeDevice();//if i use it, the program close
   pDevice = createDevice(EDT_DIRECT3D9, core::dimension2d<s32>(640,480), 32, true, true, true, &eventReceiver);
Thanks

Posted: Sun Mar 08, 2009 11:45 pm
by hybrid
You should never use an object which you have dropped! The device will be removed before you can call closeDevice on it. This will lead to illegal memory access in your app. Just do it the other way round: closeDevice, drop, createDevice (for the new one). It is usually a good idea to call device->run after closeDevice...