Yeah, you need to call:
Code: Select all
CEGUI::OgreRenderer::setFrameControlExecutionEnabled( false );to tell CEGUI not to render, so you can explicitly tell it when to render, after the overlays in your case.
My code looks something like this (chopped out a bunch of stuff for simplicity, not-tested):
Code: Select all
class UISystem: public Ogre::RenderQueueListener
{
public:
void Init( Ogre::SceneManager* pSceneMgr );
// We can specify a RenderQueue to render the UI on (actually before or after).
void SetRenderQueue( Ogre::RenderQueueGroupID i_nRenderQueue, bool i_bPostQueue );
void renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue);
void renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue);
private:
// When we draw the UI.
Ogre::RenderQueueGroupID m_nRenderQueue;
// Whether to draw CEGUI immediately before or after m_nRenderQueue
bool m_bPostQueue;
};
Code: Select all
void UISystem::Init( Ogre::SceneManager* i_pSceneMgr )
{
// -- a bunch of other CEGUI initialization code omitted here for brevity ---
// tell CEGUI that we want to handle the calls to CEGUI::System::renderGUI()
GetCEGUIOgreRenderer()->setFrameControlExecutionEnabled( false );
// Register a RenderQueueListener so we have a hook to call CEGUI::System::renderGUI()
// Be careful not to call this function more than once, or you will render your GUi multiple times per tick
i_pSceneMgr->addRenderQueueListener( this );
}
void UISystem::SetRenderQueue( Ogre::RenderQueueGroupID i_nRenderQueue, bool i_bPostQueue )
{
m_nRenderQueue = i_nRenderQueue;
m_bPostQueue = i_bPostQueue;
}
void UISystem::renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue)
{
// make sure you check the invocation string, or you can end up rendering the GUI multiple times
// per frame due to shadow cameras.
if ( !m_bPostQueue && m_nRenderQueue == id && invocation == "" )
{
CEGUI::System::getSingleton().renderGUI();
}
}
void UISystem::renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue)
{
if ( m_bPostQueue && m_nRenderQueue == id && invocation == "" )
{
CEGUI::System::getSingleton().renderGUI();
}
}If you want CEGUI to render after overlays, try:
Code: Select all
UISystem->SetRenderQueue( RENDER_QUEUE_OVERLAY, true );