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)