new D3D device -> CEGUI

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

gregee123
Just popping in
Just popping in
Posts: 17
Joined: Sun Oct 21, 2012 23:50

new D3D device -> CEGUI

Postby gregee123 » Mon Oct 22, 2012 07:06

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.

User avatar
mmixLinus
Quite a regular
Quite a regular
Posts: 71
Joined: Fri May 20, 2011 08:46
Location: Lund, Sweden
Contact:

Re: new D3D device -> CEGUI

Postby mmixLinus » Mon Oct 22, 2012 09:24

Hi,

When I receive "DeviceRestored", for CEGUI I just do

Code: Select all

      CEGUI::System::getSingleton().signalRedraw();
(I am running Ogre3D + CEGUI)

/mmixLinus;
MMiX.Me 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
(YouTube|Facebook)

gregee123
Just popping in
Just popping in
Posts: 17
Joined: Sun Oct 21, 2012 23:50

Re: new D3D device -> CEGUI

Postby gregee123 » Mon Oct 22, 2012 09:49

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 ?

Flocke
Just popping in
Just popping in
Posts: 13
Joined: Sun Nov 21, 2010 20:58
Location: Germany - Hamburg
Contact:

Re: new D3D device -> CEGUI

Postby Flocke » Mon Oct 22, 2012 11:53

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.html

In 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. :roll:

HTH

gregee123
Just popping in
Just popping in
Posts: 17
Joined: Sun Oct 21, 2012 23:50

Re: new D3D device -> CEGUI

Postby gregee123 » Mon Oct 22, 2012 12:27

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 ?

User avatar
mmixLinus
Quite a regular
Quite a regular
Posts: 71
Joined: Fri May 20, 2011 08:46
Location: Lund, Sweden
Contact:

Re: new D3D device -> CEGUI

Postby mmixLinus » Mon Oct 22, 2012 13:58

Hm, why on earth does the game create a new device when the window is resized (or at all)?! That "must" be sub-optimal! :hammer: (ok, I admit that is looking at the problem from the wrong end).

Sorry, I don't have an answer to your problem then :oops:
/mmixLinus
MMiX.Me 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
(YouTube|Facebook)

Flocke
Just popping in
Just popping in
Posts: 13
Joined: Sun Nov 21, 2010 20:58
Location: Germany - Hamburg
Contact:

Re: new D3D device -> CEGUI

Postby Flocke » Mon Oct 22, 2012 14:53

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

gregee123
Just popping in
Just popping in
Posts: 17
Joined: Sun Oct 21, 2012 23:50

Re: new D3D device -> CEGUI

Postby gregee123 » Mon Oct 22, 2012 15:10

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.

Flocke
Just popping in
Just popping in
Posts: 13
Joined: Sun Nov 21, 2010 20:58
Location: Germany - Hamburg
Contact:

Re: new D3D device -> CEGUI

Postby Flocke » Mon Oct 22, 2012 15:36

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. :(

gregee123
Just popping in
Just popping in
Posts: 17
Joined: Sun Oct 21, 2012 23:50

Re: new D3D device -> CEGUI

Postby gregee123 » Mon Oct 22, 2012 20:43

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.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests