[Solved] CEGUI initialisation causes flickering (ogre 2.0)
Moderators: CEGUI MVP, CEGUI Team
Re: CEGUI initialisation causes flickering (ogre 2.0)
Did you look at the PR i linked? It states 2.0 support for v0-8
CrazyEddie: "I don't like GUIs"
Re: CEGUI initialisation causes flickering (ogre 2.0)
EDIT: Hadn't seen your reply since it was on page 2. The pullrequest states support for ogre 2.1 which is fairly different from ogre 2.0 so that might be why it doesn't work on 2.0.
If i compare the Renderer.cpp files for default and 0.8 branches the default one does a lot of stuff with compositors while the 0.8 branch does little more than include the headers and ogre 2.0 relies heavily on compositors, don't know about 2.1.
I managed to make a workaround for the problem!
The issue occurred because there we're two "workspaces" in the ogre compositor manager, ogres and CEGUIs, each rendering loop OgreRoot.cpp called _swapAllFinalTargets() which calls OgreCompositorManager2.cpp's _swapAllFinalTargets() which for each workspace calls _swapFinalTarget() which on windows simply calls a native windows frame buffer swap. Since there we're two workspaces, that native function was called twice in a row, effectively having the second swap undo the first and resulting in an empty buffer being displayed.
I think the flickering occurred (as opposed to simply being always black) due to the display driver sometimes fetching the buffer in between the two calls, but I'm not entirely sure.
Now to me it seems really strange that you would want to swap the native buffers for each workspace and hence get an empty buffer when you have an even number of workspaces, but I don't know much about graphics programming let alone the internals of ogre so maybe something was supposed to work differently, don't know but I'll bring this up on the ogre forums.
My workaround was to, when iterating all the workspaces, always return from the function after having called the swap function for the first workspace and ignore the rest.
I added the return line in this function in OgreCompositorManager2.cpp
That swap function calls this function:
the swap there calls this function:
and that SwapBuffers is a native windows function.
This looks like an ogre issue to me, so do you want me to do anything about that ticket I created? Or just leave it be until we get some feedback from the ogre forums?
If i compare the Renderer.cpp files for default and 0.8 branches the default one does a lot of stuff with compositors while the 0.8 branch does little more than include the headers and ogre 2.0 relies heavily on compositors, don't know about 2.1.
I managed to make a workaround for the problem!
The issue occurred because there we're two "workspaces" in the ogre compositor manager, ogres and CEGUIs, each rendering loop OgreRoot.cpp called _swapAllFinalTargets() which calls OgreCompositorManager2.cpp's _swapAllFinalTargets() which for each workspace calls _swapFinalTarget() which on windows simply calls a native windows frame buffer swap. Since there we're two workspaces, that native function was called twice in a row, effectively having the second swap undo the first and resulting in an empty buffer being displayed.
I think the flickering occurred (as opposed to simply being always black) due to the display driver sometimes fetching the buffer in between the two calls, but I'm not entirely sure.
Now to me it seems really strange that you would want to swap the native buffers for each workspace and hence get an empty buffer when you have an even number of workspaces, but I don't know much about graphics programming let alone the internals of ogre so maybe something was supposed to work differently, don't know but I'll bring this up on the ogre forums.
My workaround was to, when iterating all the workspaces, always return from the function after having called the swap function for the first workspace and ignore the rest.
I added the return line in this function in OgreCompositorManager2.cpp
Code: Select all
void CompositorManager2::_swapAllFinalTargets(void)
{
WorkspaceVec::const_iterator itor = mWorkspaces.begin();
WorkspaceVec::const_iterator end = mWorkspaces.end();
while( itor != end )
{
CompositorWorkspace *workspace = (*itor);
if( workspace->getEnabled() && workspace->isValid() )
workspace->_swapFinalTarget();
return;
++itor;
}
}
That swap function calls this function:
Code: Select all
void CompositorWorkspace::_swapFinalTarget(void)
{
if( mRenderWindow.target )
mRenderWindow.target->swapBuffers();
}
the swap there calls this function:
Code: Select all
void Win32Window::swapBuffers()
{
if (!mIsExternalGLControl) {
SwapBuffers(mHDC);
}
}
and that SwapBuffers is a native windows function.
This looks like an ogre issue to me, so do you want me to do anything about that ticket I created? Or just leave it be until we get some feedback from the ogre forums?
Re: CEGUI initialisation causes flickering (ogre 2.0)
Leave it until you get feedback from Ogre. Is there a related ticket at Ogre or a thread? Then reference this in the CEGUI ticket
CrazyEddie: "I don't like GUIs"
Re: CEGUI initialisation causes flickering (ogre 2.0)
It had already been fixed in ogre 2.1, and after i pointed it out they merged that fix into 2.0 https://bitbucket.org/sinbad/ogre/commi ... 7ee5f6166c
Re: CEGUI initialisation causes flickering (ogre 2.0)
Can you confirm that this solves all issues appearing in CEGUI? If so PLEASE edit the topic title by preceding it with "[Solved]"
CrazyEddie: "I don't like GUIs"
Who is online
Users browsing this forum: Google [Bot] and 16 guests