Ogre 2.0 + multiple windows = fail

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

Boost113
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Sat Apr 12, 2014 09:44

Re: Ogre 2.0 + multiple windows = fail

Postby Boost113 » Wed Feb 04, 2015 11:33

Suslik wrote:
Boost113 wrote:You don't seem to be using the Renderer bootstrap function.

I'm not using bootstrap because it calls CEGUI::System::create inside. So if I call bootstrap once per program I get only 1 ogre renderer which's probably not the thing I want. If I call one bootstrap per window I get "Already Initialized" exception. So that's why I'm using 2 renderers without a bootstrap. Is that wrong?

The bootstrap does a few things that aren't done if you directly create the renderer, for example the Ogre workspaces won't be created.
The function (that I just created) CEGUI::OgreRenderer::registerWindow allows creating a second renderer after bootstrapping to avoid this issue.

Suslik wrote:So you advice me to create OgreRenderers manually, one per window. And I don't want to call bootstrap after that, right?

If I don't create a workspace neither for window1 nor for window2, my program crashes. If I create only one workspace for winow1, it somewhat works but window 2 still has some weird glitches:

Adding to my last comment, I recommend that you first bootstrap the first renderer and then create the second one. This way the renderer should setup its own workspace and then you just need to create one that
clears the window.
It *should* be fine to just use the constructor but the registerWindow function might get some additional things at some point like linking the renderers together to share resources (if any actually need to be shared...).

Code for creating a workspace that clears the window: http://pastebin.com/XSW1KE60

Suslik wrote:I really need multiple windows to function properly. I don't care about scaling in runtime and I use non-captured mouse so I'm not interested in mouse constraining either. Would you kindly help me with some code that I tried making somewhat bearable? It works for both ogre 2.0 and 1.9 but the second window glitches in both(in different ways). Here's the code: http://pastebin.com/i773VL6i

I've got the rendering to multiple windows working but the input needs a little tweaking:
Image
Your code seems fine, but you should call CEGUI::OgreRenderer::getDefaultRenderTarget to get the target for a context instead of

Code: Select all

new CEGUI::OgreWindowTarget(

Also you could use the bootstrapping function and then manually create the additional renderers. You could also try removing all your rendering code and this call:

Code: Select all

    ceguiOgreRenderer->setRenderingEnabled(false);

That way the ogre renderer should render automatically whenever the ogre window is rendered. (I would get rid of all the draw calls, though I would keep the time calls, in frameRenderingQueued)

Boost113
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Sat Apr 12, 2014 09:44

Re: Ogre 2.0 + multiple windows = fail

Postby Boost113 » Wed Feb 04, 2015 14:08

Now I got the input working but there seems to be some flickering issues.
What maybe happening is that Ogre isn't bothering to clear the screen every frame so the CEGUI junk shows up for a while until Ogre clears it.
The flickering seems to only happen when something is moving/updating in CEGUI and drawing a scene with Ogre (or just a skybox) is enough to solve the issue.
Image

Now I just need to get ogre to draw an empty scene every frame to clear the buffer.
After that different sized windows might cause the next issues as CEGUI::System won't know which dimensions to use.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Ogre 2.0 + multiple windows = fail

Postby Ident » Sun Feb 15, 2015 16:55

I added this to my todo list. I will likely make a OpenGL3+ Renderer based test application and try to adapt CEGUI for multi-window support. I am afraid this might have to go into default though, changes to Renderer and System will most likely have to be made :/
CrazyEddie: "I don't like GUIs"

Suslik
Just popping in
Just popping in
Posts: 10
Joined: Sun Feb 01, 2015 10:37

Re: Ogre 2.0 + multiple windows = fail

Postby Suslik » Sun Feb 15, 2015 20:06

Boost113 wrote:Now I got the input working but there seems to be some flickering issues.
What maybe happening is that Ogre isn't bothering to clear the screen every frame so the CEGUI junk shows up for a while until Ogre clears it.
The flickering seems to only happen when something is moving/updating in CEGUI and drawing a scene with Ogre (or just a skybox) is enough to solve the issue.

Yeah that's exactly the kind of issue I have discovered: weird glitches while moving/interacting with CEGUI in the second window. The glitches differ on different ogre renderers: d3d renderer draws an enlarged upside-down image while interacting with gui, opengl renderer flickers instead.

Boost113
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Sat Apr 12, 2014 09:44

Re: Ogre 2.0 + multiple windows = fail

Postby Boost113 » Mon Feb 16, 2015 15:16

Suslik wrote:
Boost113 wrote:Now I got the input working but there seems to be some flickering issues.
What maybe happening is that Ogre isn't bothering to clear the screen every frame so the CEGUI junk shows up for a while until Ogre clears it.
The flickering seems to only happen when something is moving/updating in CEGUI and drawing a scene with Ogre (or just a skybox) is enough to solve the issue.

Yeah that's exactly the kind of issue I have discovered: weird glitches while moving/interacting with CEGUI in the second window. The glitches differ on different ogre renderers: d3d renderer draws an enlarged upside-down image while interacting with gui, opengl renderer flickers instead.

It seems that all of the graphical glitches can be fixed by properly clearing the render window before each frame (I did that by drawing an ogre skybox).


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests