Explicitly render CEGUI

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

-EleMenT-
Just popping in
Just popping in
Posts: 2
Joined: Wed Jul 14, 2010 23:25

Explicitly render CEGUI

Postby -EleMenT- » Wed Jul 14, 2010 23:50

Hello all,

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!

-EleMenT-
Just popping in
Just popping in
Posts: 2
Joined: Wed Jul 14, 2010 23:25

Re: Explicitly render CEGUI

Postby -EleMenT- » Wed Jul 14, 2010 23:59

Its actually really funny that I JUST figured it out less than 10 minutes after posting. Thanks for your help everyone!!!! :mrgreen: You are that good, you didn't even have to reply :lol:

So I always hate it when people solve their own issue and neglect to post their solution, so here it was:

Code: Select all

while(true) {
        Ogre::WindowEventUtilities::messagePump();
        root->_fireFrameStarted();
       
        renderWindow->update(false);
       
        root->_fireFrameRenderingQueued();
        renderWindow->swapBuffers(true);
        root->_fireFrameEnded();
}


It seems I was trying to do too much explicitly. As you can see, this is quite similar to the implementation that I said "flickered". The issue was the ordering.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Explicitly render CEGUI

Postby CrazyEddie » Fri Jul 16, 2010 08:49

Thanks for posting your solution; I also find it annoying when people do not post their own solutions :)

CE.

Toadcop
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Mon Sep 06, 2010 18:13

Re: Explicitly render CEGUI

Postby Toadcop » Wed Nov 24, 2010 17:53

same problem here ^_^

now i am trying to find also a solution. so stay tuned ! :P

*ADD*
ok the major issue was what i didn't keeped buffer swap in sync with CEGUI updates it has cause the major flickers.

now i have have very small flickers (but objects doesnt disapper now) in widgets especialy good to see on widgets with transparency. i will try find the issue for this also and post it here =)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 7 guests