Change renderer

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

BEBEGON
Just popping in
Just popping in
Posts: 5
Joined: Fri Jun 01, 2007 10:39

Change renderer

Postby BEBEGON » Sun Jun 03, 2007 15:36

Hello.
I need to change renderer object (from D3D to OGL ) in runtime. Please, demonstrate with an example.

Thank you.

P.S. Sorry for mistakes in my english. :oops:

dmail
Quite a regular
Quite a regular
Posts: 46
Joined: Mon Nov 27, 2006 16:49

Postby dmail » Thu Jun 28, 2007 23:43

As cegui has a runtime plugin architecture I would suspect it would be a matter of pulling one system down and creating another, as the system constructor takes a parameter which is a render pointer. Could someone verify this as I have not really looked into it myself but something I would also like to know as my engine is a runtime plugin system.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Fri Jun 29, 2007 08:29

Changing renderers is not a bit deal, and is -as suggested- a matter of deleting the current System instance and building a new one. Just look at the cegui initialising code in your app and try something like this:

Code: Select all

// Create
m_renderer = new CEGUI::DirectX9Renderer(my3DDevice, 3000);
new CEGUI::System(m_renderer);
// Cleanup
delete CEGUI::System::getSingletonPtr();
delete m_renderer;
// Re-create
m_renderer = new CEGUI::OpenGLRenderer(1024);
new CEGUI::System(m_renderer);


Which should work. However after you do this you need to rebuild the CEGUI state as it was, because bringing down the system also deletes all created widgets...

HTH.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests