I am currently trying to integrate CEGUI into an existing Ogre application and have done so with moderate success. However, I am running into an issue.
This application does not render its render targets via the renderOneFrame or startRendering methods that Ogre provides. This application needs to be able to explicitly update and render particular render targets without rendering all of them. I have been dealing with this issue for hours now, and fear the solution may be right under my nose. I have been playing around with the following methods:
Code: Select all
while(true) {
Ogre::WindowEventUtilities::messagePump();
root->_fireFrameStarted();
renderWindow->update(false);
rt->update(false);
renderWindow->swapBuffers(true);
rt->swapBuffers(true);
root->_fireFrameRenderingQueued();
//root->getRenderSystem()->_swapAllRenderTargetBuffers(true);
root->_fireFrameEnded();
//
//root->renderOneFrame();
}
This code does nothing. No CEGUI window is loaded.
For context, root is the OgreRoot, renderWindow is the render target created by my test application that is passed into the System::bootstrapSystem(renderWindow) function, and rt is the CEGUI render target I managed to hack-grab from the RenderSystem. I know it is a valid instance and is the correct one through testing. I won't be able to show more code, I am sorry. Here lies the problem:
If I simply call root->renderOneFrame(); without the other stuff, CEGUI loads along with the background image of the renderWindow. Fine, but not what I want, as that renders ALL render targets.
If I do:
Code: Select all
while(true) {
Ogre::WindowEventUtilities::messagePump();
root->_fireFrameStarted();
//renderWindow->update(false);
//rt->update(false);
//renderWindow->swapBuffers(true);
//rt->swapBuffers(true);
root->_fireFrameRenderingQueued();
root->getRenderSystem()->_swapAllRenderTargetBuffers(true);
root->_fireFrameEnded();
//
//root->renderOneFrame();
}
CEGUI loads a window, but the background is black.
If I do:
Code: Select all
while(true) {
Ogre::WindowEventUtilities::messagePump();
root->_fireFrameStarted();
renderWindow->update(false);
//rt->update(false);
//renderWindow->swapBuffers(true);
//rt->swapBuffers(true);
root->_fireFrameRenderingQueued();
root->getRenderSystem()->_swapAllRenderTargetBuffers(true);
root->_fireFrameEnded();
//
//root->renderOneFrame();
}
There is very fast flickering between the CEGUI window and the background image, as the buffers swap. I know that you probably have to render renderWindow in this case as CEGUI is using it, but that isn't the point. What I am trying to accomplish is to be able to explicitly render CEGUI and its render target from code not using methods like renderOneFrame(); or startRendering(); I have searched a lot for this, and maybe I missed something, so any help is appreciated.
Thanks!