<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sheda</id>
		<title>CEGUI Wiki - Crazy Eddie's GUI System (Open Source) - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cegui.org.uk/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sheda"/>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/Special:Contributions/Sheda"/>
		<updated>2026-04-06T03:45:23Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Getting_CEGUI_Rendering&amp;diff=3381</id>
		<title>The Beginner Guide to Getting CEGUI Rendering</title>
		<link rel="alternate" type="text/html" href="http://cegui.org.uk/wiki/index.php?title=The_Beginner_Guide_to_Getting_CEGUI_Rendering&amp;diff=3381"/>
				<updated>2010-05-08T14:08:33Z</updated>
		
		<summary type="html">&lt;p&gt;Sheda: /* Create an instance of a CEGUI::Renderer based object */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|message=This tutorial is for CEGUI versions up to 0.6.2.  For later releases, see the tutorials in the main documentation.}}&lt;br /&gt;
&lt;br /&gt;
In order to get CEGUI to render, no matter what your target engine is, there are basically three steps that must be done.&lt;br /&gt;
&lt;br /&gt;
#Create an instance of a CEGUI::Renderer based object.&lt;br /&gt;
#Create the CEGUI::System object.&lt;br /&gt;
#Call the method to render the GUI.&lt;br /&gt;
&lt;br /&gt;
Obviously you also need to load some data and perform very basic initialisation, which is covered in [[The Beginner Guide to Loading Data Files and Initialisation]], and also you need to get your inputs into the system which is covered in [[The Beginner Guide to Injecting Inputs]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Create an instance of a CEGUI::Renderer based object ===&lt;br /&gt;
This is fairly straight forward and should pose no major obstacles for any of the supported renderers.  You must of course remember to include the header file for the renderer that you will be using, also remember that for Ogre3D the renderer module now comes with CEGUI and not Ogre (Huh? Since when? As of 23/02/2010 (CEGUI 0.7.1, OGRE 1.7) the module is called CEGUIOgreRenderer, and is in CEGUI's sources, not Ogre's). (Note that you need to delete the Renderer object when you are cleaning up the program.) &lt;br /&gt;
&lt;br /&gt;
The basic renderer creation code is:&lt;br /&gt;
&lt;br /&gt;
'''Direct3D 8.1'''&lt;br /&gt;
 CEGUI::DirectX81Renderer* myRenderer =&lt;br /&gt;
    new CEGUI::DirectX81Renderer( myD3D8Device );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Direct3D 9'''&lt;br /&gt;
 CEGUI::DirectX9Renderer* myRenderer =&lt;br /&gt;
    new CEGUI::DirectX9Renderer( myD3D9Device, 0 );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OpenGL'''&lt;br /&gt;
 CEGUI::OpenGLRenderer* myRenderer = &lt;br /&gt;
    new CEGUI::OpenGLRenderer( 0 );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Ogre3D'''&lt;br /&gt;
 CEGUI::OgreCEGUIRenderer* myRenderer = &lt;br /&gt;
    new CEGUI::OgreCEGUIRenderer( myRenderWindow );&lt;br /&gt;
''Note:'' Using Ogre 1.4.9 with CEGUI 0.6.2 binding the renderer to the scene manager seems to be required (in my case the GUI was not displayed while the mouse events were properly processed). To bind a scene manager to the renderer, use the ''setTargetSceneManager'' method:&lt;br /&gt;
 myRenderer-&amp;gt;setTargetSceneManager(mySceneManager);&lt;br /&gt;
&lt;br /&gt;
'''Irrlicht Engine'''&lt;br /&gt;
 CEGUI::IrrlichtRenderer* myRenderer = &lt;br /&gt;
    new CEGUI::IrrlichtRenderer( myIrrlichtDevice, true );&lt;br /&gt;
&lt;br /&gt;
=== Create the CEGUI::System object to initialise the system ===&lt;br /&gt;
Another extremely simple step.  Just instantiate the CEGUI::System object by using 'new' and passing in a pointer to the CEGUI::Renderer that you created in the previous step.  This will cause the entire system to initialise itself.&lt;br /&gt;
&lt;br /&gt;
 new CEGUI::System( myRenderer );&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Call the method to render the GUI ===&lt;br /&gt;
This is the only step that, depending upon your target engine, can be done differently.  Basically what you need to do call the CEGUI::System::renderGUI method at the end of your rendering loop.  For lucky users of the Ogre3D engine, this step is taken care of automatically.  For everybody else, some simple example code can be seen below&lt;br /&gt;
&lt;br /&gt;
'''Direct3D 8.1 / 9'''&lt;br /&gt;
 // Start the scene&lt;br /&gt;
 myD3DDevice-&amp;gt;BeginScene();&amp;lt;br&amp;gt;&lt;br /&gt;
 // clear display&lt;br /&gt;
 myD3DDevice-&amp;gt;Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);&amp;lt;br&amp;gt;&lt;br /&gt;
 // user function to draw 3D scene&lt;br /&gt;
 draw3DScene();&amp;lt;br&amp;gt;&lt;br /&gt;
 // draw GUI&lt;br /&gt;
 '''CEGUI::System::getSingleton().renderGUI();'''&amp;lt;br&amp;gt;&lt;br /&gt;
 // end the scene&lt;br /&gt;
 myD3DDevice-&amp;gt;EndScene();&amp;lt;br&amp;gt;&lt;br /&gt;
 // finally present the frame.&lt;br /&gt;
 myD3DDevice-&amp;gt;Present(0, 0, 0, 0);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OpenGL'''&lt;br /&gt;
 // user function to draw 3D scene&lt;br /&gt;
 draw3DScene();&amp;lt;br&amp;gt;&lt;br /&gt;
 // draw GUI (should not be between glBegin/glEnd pair)&lt;br /&gt;
 '''CEGUI::System::getSingleton().renderGUI();'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Irrlicht'''&lt;br /&gt;
 // start the scene&lt;br /&gt;
 myIrrlichtDriver-&amp;gt;beginScene(true, true, irr::video::SColor(150,50,50,50));&amp;lt;br&amp;gt;&lt;br /&gt;
 // draw main scene&lt;br /&gt;
 myIrrlichtSceneManager-&amp;gt;drawAll();&amp;lt;br&amp;gt;&lt;br /&gt;
 // draw gui&lt;br /&gt;
 '''CEGUI::System::getSingleton().renderGUI();'''&amp;lt;br&amp;gt;&lt;br /&gt;
 // end the scene&lt;br /&gt;
 myIrrlichtDriver-&amp;gt;endScene();&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
This is the ''most basic'' introduction to setting up CEGUI to render.  There are things not covered here, such as using different scene managers in Ogre and advanced options such as user specified resource providers, and so on.&lt;br /&gt;
&lt;br /&gt;
[[User:CrazyEddie|CrazyEddie]] 03:34, 9 February 2008 (PST)&lt;/div&gt;</summary>
		<author><name>Sheda</name></author>	</entry>

	</feed>