MyGUI port to Ogre 2.0 released


06-02-2015 15:16:00

Support for Ogre 2.0 has been pushed to a branch.

It uses the new custom compositor pass feature for rendering, which I think is quite elegant, as it gives you some more freedom when and how MyGUI is rendered, whether it should be affected by other compositors, etc.

Quick start:

1. Initialise MyGUI Platform

mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);

2. Set up MyGUI compositor pass in your workspace, after MyGUI Platform was initialised

Ogre::CompositorManager2* pCompositorManager = Ogre::Root::getSingleton().getCompositorManager2();
Ogre::CompositorNodeDef *nodeDef = pCompositorManager->addNodeDefinition( "myworkspace" );
//Input texture
nodeDef->addTextureSourceName( "WindowRT", 0, Ogre::TextureDefinitionBase::TEXTURE_INPUT );
nodeDef->setNumTargetPass( 1 );
Ogre::CompositorTargetDef *targetDef = nodeDef->addTargetPass( "WindowRT" );
targetDef->setNumPasses( 3 );
Ogre::CompositorPassClearDef* passClear = static_cast<Ogre::CompositorPassClearDef*>
( targetDef->addPass( Ogre::PASS_CLEAR ) );
Ogre::CompositorPassSceneDef *passScene = static_cast<Ogre::CompositorPassSceneDef*>
( targetDef->addPass( Ogre::PASS_SCENE ) );
passScene->mShadowNode = Ogre::IdString();

// For the MyGUI pass
targetDef->addPass( Ogre::PASS_CUSTOM, MyGUI::OgreCompositorPassProvider::mPassId );
Ogre::CompositorWorkspaceDef *workDef = pCompositorManager->addWorkspaceDefinition( workspaceName );
workDef->connectOutput( nodeDef->getName(), 0 );

pCompositorManager->addWorkspace(mSceneManager, mWindow, mCamera, workspaceNameHash, true);


07-02-2015 09:53:09

I think this should be done next way:
Add new platform, MyGUI.Ogre2Platform.
Add new value in CMake for MYGUI_RENDERSYSTEM.
It seems to be not so hard to use Ogre version check in demos/tools to have both Ogre2 and Ogre1 kept in same files. Otherwise it will be necessaty to add Ogre2 BaseManager and other classes like it is done for other platforms.


07-02-2015 14:50:13

Yes, that is the way I was thinking to ultimately do it so it can be released alongside Ogre 1.x support.


29-08-2016 07:28:09

thanks for this guide :D