Device recreation

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
karkas1
Posts: 3
Joined: Sun Mar 31, 2013 5:59 pm

Device recreation

Post by karkas1 »

Hello

I'd like to know some information about the recreation of a device. If you want to change any of parameters which were given on device creation (like window size, device type ect.) you actually have to recreate the device.

Although the recreation doesn't seem so scary, the part I'm worrying about is the data that was stored within - all the scene data gui data and so on is lost if I understand it correctly.

So my question is: Is it somehow possible to 'copy' already uploaded data from one device to the recreated one. That is important if for example player wants to adjust his video settings (IN-game) because his game lags and he would have to wait for the data to be re-uploaded.

Thanks in advance.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Device recreation

Post by robmar »

All those points are well supported by Irrlicht.

Use:-

device->setResizable( true ); // Window is resizeable. Note: This must be called otherwise 3D does not track MFC window

Then you can call this, when the window size changes:-

const core::dimension2d<u32> screensize = core::dimension2d<u32>( cxv, cy );
pDriver->OnResize( screensize );

You´ll also have to reset the aspect ration if that has changed.

As to "data" loaded, there is extensive support for node serialisation, so no problems there.

Follow the examples given and everything will usually go well.
karkas1
Posts: 3
Joined: Sun Mar 31, 2013 5:59 pm

Re: Device recreation

Post by karkas1 »

Thanks for the serialization hint I will look up more info about this.

Although for other parameters (except window size :P) for example toggling fullscreen mode I assume the device recreation is a must.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Device recreation

Post by robmar »

You can change and position the irrlicht device window quite easily, including to go full-screen, or multiscreen. You can even create split views, like a quad view, and position it across 4 monitors; its really very flexible and irrlicht code is very clean and efficient.

Take your time though, there is a lot to see!
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Device recreation

Post by Andreas »

Hi,

sorry to bump this thread, but i'm very interested in changing the video settings without re-creating the irrlicht device. Thanks for the pointer
to the OnResize() method, i wouldn't have used it since the API Doc says: "Only used by the engine internally." But when testing it, i noticed it
only changes the "internal" resolution, but not the actual window size of the irrlicht application. Is this possible without re-creating the irrlicht device?

And could you give me a hint how to toggle fullscreen dynamically? I didn't find any method like "setFullscreen(bool)" in the VideoDriver. :)

Thanks a lot
Andreas
karkas1
Posts: 3
Joined: Sun Mar 31, 2013 5:59 pm

Re: Device recreation

Post by karkas1 »

After a bit of searching I found this old post. (hopefully nothing changed in Irrlicht 1.8 :D)

http://irrlicht.sourceforge.net/forum/v ... hp?t=43379

As stated there basically you have to recreate the device if you want to change any of the initial parameters...
Andreas
Posts: 166
Joined: Sun Oct 31, 2004 7:15 am
Location: Münster / Germany
Contact:

Re: Device recreation

Post by Andreas »

Thanks for the clarification, i obviously misunderstood robmar's reply. :)
Post Reply