namespace CEGUI {
/**
@page rendering_tutorial The Beginners Guide to Getting CEGUI Rendering
@author Paul D Turner

@section rendering_tutorial_intro Introduction
In order to get CEGUI to render - regardless of your target API or engine -
there are basically three steps that need to be performed:
- Create an instance of a CEGUI::Renderer based object.
- Create the CEGUI::System object (passing in the renderer created above).
- Each frame, call the CEGUI::System::renderGUI function to perform the rendering.

Obviously you also need to load some data and perform other basic initialisation,
which is covered in @ref resprov_tutorial and @ref datafile_tutorial.  You'll also need
to get your inputs into the system so that you can interact with the GUI
elements, this is covered in @ref input_tutorial.

<br>
@section rendering_tutorial_bootstrap The Easy Way: Renderer 'bootstrapSystem' functions
This section describes the quickset and easiest way to get CEGUI up and running,
and that is to use the static 'bootstrap' helper functions that are available on the
Renderer class for your chosen API or engine.  Unless you're doing something advanced or
otherwise unusual, these are the fuctions you'll want to use, since they enable the
creation of all the initial CEGUI objects in a single call.

Note that the Renderers also have destroySystem functions for cleaning up afterwards.

The Ogre3D and Irrlicht engines each have their own intergrated file loading and
image parsing functionality which CEGUI can seamlessly make use of via custom
implementations of the CEGUI::ResourceProvider and CEGUI::ImageCodec interfaces.
In order to make use of these implementations, the user would typically be
required to create instances of these objects and pass them, along with the
CEGUI::Renderer, to the System::create function.  Since this over-complicates
system construction for even the most simplest of uses, the bootstrapSystem
functions for those Renderers will creates all these supporting objects automatically.

As stated above, when using the boostrapSystem functions, starting up CEGUI is
as simple as a single function call:

@subsection rendering_tutorial_bootstrap_opengl OpenGL
@code
// Bootstrap CEGUI::System with an OpenGLRenderer object that uses the
// current GL viewport, the DefaultResourceProvider, and the default
// ImageCodec.
CEGUI::OpenGLRenderer& myRenderer =
    CEGUI::OpenGLRenderer::bootstrapSystem();
@endcode

@subsection rendering_tutorial_bootstrap_d3d Direct3D
Note that this code shows the D3D9 renderer, but the D3D10 and D3D11
renderers are largely the same.
@code
// Bootstrap CEGUI::System with a Direct3D9Renderer object that uses the
// DefaultResourceProvider, and the default ImageCodec.
CEGUI::Direct3D9Renderer& myRenderer =
    CEGUI::Direct3D9Renderer::bootstrapSystem( myD3D9Device );
@endcode

@subsection rendering_tutorial_bootstrap_ogre Ogre3D
@code
// Bootstrap CEGUI::System with an OgreRenderer object that uses the
// default Ogre rendering window as the default output surface, an Ogre based
// ResourceProvider, and an Ogre based ImageCodec.
CEGUI::OgreRenderer& myRenderer =
    CEGUI::OgreRenderer::bootstrapSystem();
@endcode

@subsection rendering_tutorial_bootstrap_irrlicht Irrlicht
@code
// Bootstrap CEGUI::System with an IrrlichtRenderer object, an Irrlicht based
// ResourceProvider, and an Irrlicht based ImageCodec.
CEGUI::IrrlichtRenderer& myRenderer =
    CEGUI::IrrlichtRenderer::bootstrapSystem( myIrrlichtDevice );
@endcode

<br>
@section rendering_tutorial_nonbootstrap The Hard Way: Manual object creation.
If for some reason you don't want to use the bootstrapSystem functions, you
can still, of course, create all the required objects manually.  The following
describes the creation of the Renderer and System objects via separate calls.
Note that if you have already used the boostrapSystem function, you do not need
to perform the following steps, and can instead skip to @ref rendering_tutorial_draw

<br>
@section rendering_tutorial_renderer Create an instance of a CEGUI::Renderer based object
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.

The basic renderer creation code is:
@subsection rendering_tutorial_renderer_d3d9 Direct3D 9
@code
CEGUI::Direct3D9Renderer& myRenderer =
    CEGUI::Direct3D9Renderer::create( myD3D9Device );
@endcode

@subsection rendering_tutorial_renderer_d3d10 Direct3D 10
@code
CEGUI::Direct3D10Renderer& myRenderer =
    CEGUI::Direct3D10Renderer::create( myD3D10Device );
@endcode

@subsection rendering_tutorial_renderer_ogl OpenGL
@code
// Create an OpenGLRenderer object that uses the current GL viewport as
// the default output surface.
CEGUI::OpenGLRenderer& myRenderer =
    CEGUI::OpenGLRenderer::create();
@endcode

@subsection rendering_tutorial_renderer_ogre Ogre3D
@code
// Create an OgreRenderer object that uses the default Ogre rendering
// window as the default output surface.
CEGUI::OgreRenderer& myRenderer =
    CEGUI::OgreRenderer::create();
@endcode

@subsection rendering_tutorial_renderer_irrlicht Irrlicht Engine
@code
CEGUI::IrrlichtRenderer& myRenderer =
    CEGUI::IrrlichtRenderer::create( myIrrlichtDevice );
@endcode

@subsection rendering_tutorial_renderer_dfb DirectFB
@code
// Create DirectFBRenderer that draws to the given DirectFB surface using
// the given IDirectFB instance.
CEGUI::DirectFBRenderer& myRenderer =
    CEGUI::DirectFBRenderer::create( *myDirectFB, *myDirectFBSurface );
@endcode

<br>
@section rendering_tutorial_system Create the CEGUI::System object to initialise the system
Another extremely simple step.  Just instantiate the CEGUI::System object by
using the System::create function, passing in the reference to the
CEGUI::Renderer that you created in the previous step.  This will cause the
core CEGUI system to initialise itself.
@code
CEGUI::System::create( myRenderer );
@endcode

<br>
@section rendering_tutorial_draw Call the function to render the GUI
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
function at the end of your rendering loop.  For users of the Ogre3D engine,
this step is taken care of automatically.  For everybody else, some simple
example code can be seen below:
@subsection rendering_tutorial_draw_d3d9 Direct3D 9
@code
// Start the scene
myD3DDevice->BeginScene();
// clear display
myD3DDevice->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
// user function to draw 3D scene
draw3DScene();

    // draw GUI
    CEGUI::System::getSingleton().renderGUI();

// end the scene
myD3DDevice->EndScene();
// finally present the frame.
myD3DDevice->Present(0, 0, 0, 0);
@endcode

@subsection rendering_tutorial_draw_d3d10 Direct3D 10
@code
// define colour view will be cleared to
float clear_colour[4] = { 0.0f, 0.0f, 0.0f, 1.0f };

// clear display
myD3DDevice->ClearRenderTargetView(myRenderTargetView, clear_colour);

// user function to draw 3D scene
draw3DScene();

    // draw GUI
    CEGUI::System::getSingleton().renderGUI();

// present the newly drawn frame.
mySwapChain->Present(0, 0);
@endcode

@subsection rendering_tutorial_draw_ogl OpenGL
@code
// user function to draw 3D scene
draw3DScene();

    // draw GUI (should not be between glBegin/glEnd pair)
    CEGUI::System::getSingleton().renderGUI();
@endcode

@subsection rendering_tutorial_draw_irrlicht Irrlicht
@code
// start the scene
myIrrlichtDriver->beginScene(true, true, irr::video::SColor(150,50,50,50));
// draw main scene
myIrrlichtSceneManager->drawAll();

    // draw gui
    CEGUI::System::getSingleton().renderGUI();

// end the scene
myIrrlichtDriver->endScene();
@endcode

@subsection rendering_tutorial_draw_dfb DirectFB
@code
// clear display
myDirectFBSurface->Clear( myDirectFBSurface, 0x0, 0x0, 0x0, 0xFF );

// TODO: Do other drawing here.

    // draw the GUI
    CEGUI::System::getSingleton().renderGUI();

// flip the surface we just rendered
myDirectFBSurface->Flip(myDirectFBSurface, 0, (DFBSurfaceFlipFlags)0);
@endcode

<br>
@section rendering_tutorial_conclusion Conclusion
This is the <em>most basic</em> introduction to setting up CEGUI to render.
There are things not covered here, such as using different rendering targets in
Ogre and advanced options such as user specified resource providers, and so on.

*/ 
}
