This is what my game is supposed to look like (linux build): http://youtu.be/rrs_-a_WnZY
This is what it looks like when I run it on the iOS simulator: http://youtu.be/fWp7qRYm3J4
Note there's an unrelated issue in that a LINE_LIST is being interpreted as a LINE_STRIP (i.e. the grid lines are connected by diagonals), so please ignore this when watching the videos.
So it seems that to some extent CEGUI is working on iOS, but there are some problems with the OGRE Renderer. I've been looking at the OGRE Renderer code and I can't seem to figure out what the issue is. It appears as though the render target for CEGUI is a small subset of the Ogre window target. Furthermore, it seems that the camera projection is off (the image is streched and rotated).
My first thought was that perhaps the dimensions of the window target change during the life cycle of the iPhone app and that CEGUI is initialized when it is in a different state then it is during most of the runtime. However, I've tried to adding a call to
Code: Select all
mRenderer->setDefaultRootRenderTarget(*mWindow);
at every frame (just to see if it gets new information into the CEGUI ogre renderer). Note that mRenderer is a CEGUIOgreRenderer and mWindow is an Ogre::RenderWindow which extends Ogre::RenderTarget.
From looking at the code:
CEGUIOgreRenderer.cpp
Code: Select all
//----------------------------------------------------------------------------//
void OgreRenderer::beginRendering()
{
if ( !d_pimpl->d_previousVP )
{
d_pimpl->d_previousVP = d_pimpl->d_renderSystem->_getViewport();
if ( d_pimpl->d_previousVP && d_pimpl->d_previousVP->getCamera() )
d_pimpl->d_previousProjMatrix =
d_pimpl->d_previousVP->getCamera()->getProjectionMatrixRS();
}
d_pimpl->d_defaultRoot->getRenderTarget().activate();
initialiseRenderStateSettings();
if (d_pimpl->d_makeFrameControlCalls)
d_pimpl->d_renderSystem->_beginFrame();
}
//----------------------------------------------------------------------------//
void OgreRenderer::endRendering()
{
if (d_pimpl->d_makeFrameControlCalls)
d_pimpl->d_renderSystem->_endFrame();
d_pimpl->d_defaultRoot->getRenderTarget().deactivate();
if ( d_pimpl->d_previousVP )
{
d_pimpl->d_renderSystem->_setViewport(d_pimpl->d_previousVP);
if ( d_pimpl->d_previousVP->getCamera() )
{
d_pimpl->d_renderSystem->_setProjectionMatrix(
d_pimpl->d_previousProjMatrix);
d_pimpl->d_renderSystem->_setViewMatrix(
d_pimpl->d_previousVP->getCamera()->getViewMatrix());
}
d_pimpl->d_previousVP = 0;
d_pimpl->d_previousProjMatrix = Ogre::Matrix4::IDENTITY;
}
}
It appears that the CEGUIOgreRenderer gets a pointer to the viewport from the Ogre::RenderSystem and uses the projection matrix from that to render the images. This seems to me like it should render the CEGUI correctly then since my scene is rendered correctly. Is there anyone who has more experience with the CEGUIOgreRenderer that can point me in the right direction here?