Well according to your description we can be 100% sure now that the states are not set when the second guicontext is being rendered.
How do you render the GuiContexts? Show me the lines for rendering please.
Multiple windows with Ogre3D and CEGUI
Moderators: CEGUI MVP, CEGUI Team
Re: Multiple windows with Ogre3D and CEGUI
CrazyEddie: "I don't like GUIs"
Re: Multiple windows with Ogre3D and CEGUI
Sorry but due to a connection error (I think) my post never arrived -.-'
So...
I never (explicitly) render guicontexts, I only call root->renderOneFrame(); where root is the Ogre::Root singleton, the call stack that I previously posted is (I think) the responsable for the rendering of the contexts whithin these functions:
and
which seems to take care only of one GuiContext... (the draw instead is called for each guiContext)
Do you think that the problem could be here?
So...
I never (explicitly) render guicontexts, I only call root->renderOneFrame(); where root is the Ogre::Root singleton, the call stack that I previously posted is (I think) the responsable for the rendering of the contexts whithin these functions:
Code: Select all
void System::renderAllGUIContexts()
{
d_renderer->beginRendering();
for (GUIContextCollection::iterator i = d_guiContexts.begin();
i != d_guiContexts.end();
++i)
{
(*i)->draw();
}
d_renderer->endRendering();
// do final destruction on dead-pool windows
WindowManager::getSingleton().cleanDeadPool();
}
and
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();
}
//FIXME: ???
System::getSingleton().getDefaultGUIContext().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();
//FIXME: ???
System::getSingleton().getDefaultGUIContext().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;
}
}
which seems to take care only of one GuiContext... (the draw instead is called for each guiContext)
Do you think that the problem could be here?
Re: Multiple windows with Ogre3D and CEGUI
Each time you call Ogre's render function on your RenderWindow you should:
Explicitly call CEGUIOGreRenderer::beginRendering()
and then draw() on the GUIContext that is associated with that RenderWindow
Does this solve your issue?
Explicitly call CEGUIOGreRenderer::beginRendering()
and then draw() on the GUIContext that is associated with that RenderWindow
Does this solve your issue?
CrazyEddie: "I don't like GUIs"
Re: Multiple windows with Ogre3D and CEGUI
Sorry for the delay, the time runs too quickly hehe XD
So the problem is that the ogre's render function is called one time at all (not once per window) so I can't call the functions at each render.
What I have done is this:
That seems to work (I am not sure because I can't test everything now) so my guess is that is happening something like that
so by calling the two functions at the end it works by coincidence but it won't work if for example I have 3 windows.
I am not sure about what I said because I am far from being an expert of these things does it make sense?
If I find some time I'll try to examine the code more deeply...
Thanks
So the problem is that the ogre's render function is called one time at all (not once per window) so I can't call the functions at each render.
What I have done is this:
Code: Select all
root->renderOneFrame();
guiRenderer->initialiseRenderStateSettings();
secondGuiContext->draw();
That seems to work (I am not sure because I can't test everything now) so my guess is that is happening something like that
- Ogre renders first window
- CEGUI renders first window
- CEGUI renders second window
- CEGUI renders first window
- Ogre renders second window
so by calling the two functions at the end it works by coincidence but it won't work if for example I have 3 windows.
I am not sure about what I said because I am far from being an expert of these things does it make sense?
If I find some time I'll try to examine the code more deeply...
Thanks
Re: Multiple windows with Ogre3D and CEGUI
pawn wrote:That seems to work (I am not sure because I can't test everything now) so my guess is that is happening something like that
- Ogre renders first window
- CEGUI renders first window
- CEGUI renders second window
- Ogre renders second window
Yes, this is what I pointed out (or at least tried to point out) earlier.
You clearly visualised it better than I did.
And yes, this is the issue to solve, and you can solve it by taking control of when you render the Ogre Window and when you render the CEGUI's GUI context. The latter you already do!
I am not sure how you can separate the rendering of Ogre windows, this is somewhat of an ogre issue. My guess would be that there would at least be some kind of handler for pre-window rendering that you can register for each window and put the CEGUI draw call into.
This is an Ogre issue however, so I cannot help you with specifics there. If you find out how to do this please post it here.
CrazyEddie: "I don't like GUIs"
Who is online
Users browsing this forum: Google [Bot] and 16 guests