MyGUI in Ogre RTT and direct call texture display

Source: Internet
Author: User

After using MyGUI,

It is good to use, but I found a problem with too little information,

No way, you can only chew on the code,

Here we will talk about the use of MyGUI:

1. RTT rendering to texture:

This is very simple. First, confirm the Canvas to be displayed in Layout,

Get it in the program

MyGUI: Canvas * canvas2;
AssignWidget (canvas2, "SceneAddView ");

Then assign it to a RenderBoxScene

Wraps: RenderBoxScene mRenderBoxScene;
MRenderBoxScene. setCanvas (canvas2 );

Insert Mesh again, OK

(If there is a problem in Debug, refer to the previous article. I hope there will be Q & A in brick shops)
MRenderBoxScene. injectObject ("Robot. mesh ");
MRenderBoxScene. setAutoRotation (true );
MRenderBoxScene. setMouseRotation (true );

2. directly use the texture in Ogre

To display a Real-Time Ogre texture in an ImageBox,

First of all

MyGUI: ImageBox * mAtlasView;

MyGUI: OgreTexture * mTexture;

AssignWidget (mAtlasView, "AtlasView ");

Then you need to specify the texture at the Tex manager of Ogre,

Ogre: TexturePtr layer0 = Ogre: TextureManager: getSingletonPtr ()-> getByName ("<TileImagesetTexture> ");

Here it is transitioned and assigned to a MyGUI OgreTexture. It is not clear about other usage, so we can only use this hack for the time being.

MTexture = (MyGUI: OgreTexture *) MyGUI: RenderManager: getInstance (). createTexture ("AtlasView ");

MTexture-> setOgreTexture (layer0 );

Set the size of a specific texture

MyGUI: IntCoord coord (0, 0, 1024,128 );

And the size of each small image (if you want to display the entire image, you can directly coord. size ())
MyGUI: types: TSize <int> tileSize (64, 64 );

Here, I do not know why MyGUI does not initialize the Index through the setImageInfo initialization method,

If the following line is not added, the image cannot be displayed.
MAtlasView-> setItemSelect (0 );
MAtlasView-> setImageInfo ("AtlasView", coord, tileSize );

3, PS:

MyGUI is native to support OIS, there are options in CMake, just set it, the practice in the previous article is too painful.

Attached is the architecture diagram of MyGUI.

(Save it as a browser)

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.