Cegui beginner's Guide 1-use cegui for rendering

Source: Internet
Author: User

Beginner's Guide to Using cegui Rendering
From ceguiwiki

No matter which engine is used, there must be three steps to use cegui to render the GUI

  1. Create a cegui: Renderer base object.
  2. Create cegui: System Object.
  3. Call related methods to render the GUI

It is obvious that some basic files must be loaded before this, which will be described in the following loading data files and initialization. In addition, you must obtain system input, which will be introduced in the beginner's guide for inserting input.
 

1. Create a cegui: Renderer base object.

You must include the header file that you use the Renderer.

Basic creation code:

Direct3d 8.1

Cegui: directx81renderer * myrenderer =
New cegui: directx81renderer (myd3d8device );

Direct3d 9

Cegui: directx9renderer * myrenderer =
New cegui: directx9renderer (myd3d9device );

OpenGL

Cegui: openglrenderer * myrenderer =
New cegui: openglrenderer (0 );

Ogre3d

Cegui: ogreceguirenderer * myrenderer =
New cegui: ogreceguirenderer (myrenderwindow );

Irrlicht Engine

Cegui: irrlichtrenderer * myrenderer =
New cegui: irrlichtrenderer (myirrlichtdevice, true );

 

2. Create a cegui: System Object.

Pass a Renderer pointer just created
New cegui: System (myrenderer );

 

3. Call relevant methods to render the GUI

This is the only step related to your Renderer, so you need to call it separately as needed. You must call cegui: System: rendergui at the end of the rendering loop. Users of the ogre3d engine do not need to do this. Example:

Direct3d 8.1/9

// 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 );

OpenGL

// User Function to draw 3D scene
Draw3dscene ();
// Draw gui (shocould not be between glbegin/glend pair)
Cegui: System: getsingleton (). rendergui ();

Irrlicht

// 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 ();

4 Conclusion
This is the most basic tutorial for cegui. Some topics are not described here, such as using different scenario managers in oger3d, and some advanced topics, such as user selection of resource providers.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.