Change device settings at runtime

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Malebolge
Posts: 19
Joined: Sun Aug 31, 2008 8:24 pm

Change device settings at runtime

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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...
Post Reply