Page 1 of 1

Change renderer

Posted: Sun Jun 03, 2007 15:36
by BEBEGON
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:

Posted: Thu Jun 28, 2007 23:43
by dmail
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.

Posted: Fri Jun 29, 2007 08:29
by scriptkid
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.