Page 1 of 1
new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 07:06
by gregee123
Hello all.
I have attached CEGUI to a game that creates a new D3D device every time you switch between windowed/full screen mode and also if window size changes. Does that mean I will need to fully reinitialize CEGUI every single time ? Load layouts, imagesets, fonts, schemes and so on ? Or is there a short cut I can take ?
Greg.
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 09:24
by mmixLinus
Hi,
When I receive "DeviceRestored", for CEGUI I just do
Code: Select all
CEGUI::System::getSingleton().signalRedraw();
(I am running Ogre3D + CEGUI)
/mmixLinus;
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 09:49
by gregee123
But I'm talking about a situation where a completely new dev is being created every time. How will the renderer and system be notified about this new D3Ddev ?
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 11:53
by Flocke
for resizing or switching fullscreen you rather should reset the device instead
I guess the renderer takes notice automaticly, using OGRE myself too, but there are two public support functions for a device reset:
http://www.cegui.org.uk/docs/current/cl ... derer.htmlIn case you really want to create a new device, I guess you'll have to look into the bootstrapSystem function and see what it does to manually recreate your Direct3D9Renderer.
Eventuallly the static create and destroy functions will do.
HTH
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 12:27
by gregee123
Problem is you cannot send the new device to the system object you need to create a new system which in turn recreates all the managers hence I'll need to reload everything, right ?
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 13:58
by mmixLinus
Hm, why on earth does the game create a new device when the window is resized (or at all)?! That "must" be sub-optimal!
(ok, I admit that is looking at the problem from the wrong end).
Sorry, I don't have an answer to your problem then
/mmixLinus
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 14:53
by Flocke
agreed, you really shouldn't need to create a new device for this
beside, taking a glance at the system header you could try to derive from system class to access the protected renderer attribute
(ofc you'd have to implement your own bootstrap then)
but that might well cause trouble with cegui and previously loaded resources
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 15:10
by gregee123
Accessing the d_renderer is no good anyway as it's a reference not a pointer so I don't think it can be reinitialized.
Wonder how this lib would go about rendering the GUI in a multi-monitor environment.... guess that's simply not supported, right? Unless you put all of it on one monitor.
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 15:36
by Flocke
gregee123 wrote:Accessing the d_renderer is no good anyway as it's a reference not a pointer so I don't think it can be reinitialized.
internally the renderer is stored by a simple pointer, the reference in constuctor is simply to prevent passing NULL I guess:
Renderer* d_renderer; //!< Holds the pointer to the Renderer object given to us in the constructor
gregee123 wrote:Wonder how this lib would go about rendering the GUI in a multi-monitor environment.... guess that's simply not supported, right? Unless you put all of it on one monitor.
Can't tell you on that, sry.
Re: new D3D device -> CEGUI
Posted: Mon Oct 22, 2012 20:43
by gregee123
Thanks for the answers!
It turns out that with all these objects so tightly coupled with each other I need to destroy the "system object" and initialize it from scratch with all the singletons/managers.