Page 1 of 3

Render overlay on top of cegui window

Posted: Thu Feb 18, 2010 12:55
by wizzler
I've got OGRE rendering CEGUI where i would like to place an overlay on top of the CEGUI window.

I initialise CEGUI in my main application class

Code: Select all

CEGUI::OgreRenderer::bootstrapSystem();
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");


This is also where i init the overlay.

later i initialise the window gui sheet in a playstate class like so:

Code: Select all

mCEGUIWinMgr = &CEGUI::WindowManager::getSingleton();
   CEGUI::Window* sheet = mCEGUIWinMgr->createWindow("DefaultGUISheet", "GameLayout"); 
   CEGUI::System::getSingletonPtr()->setGUISheet(sheet);
   CEGUI::Window* guiLayout = mCEGUIWinMgr->loadWindowLayout("GameLayout.layout");
   sheet->addChildWindow(guiLayout);


and when i show the overlay, cegui renders on top of everything which i don't want to.
Image

i've tried the zorder moveback but that didnt work. any ideas?

Re: Render overlay on top of cegui window

Posted: Thu Feb 18, 2010 17:39
by scriptkid
Hi,

I am no expert on this matter, but you might tell Ogre about its RenderQueue to use for its overlays, although i would suppose that overlays are already put into the highest one. Anyway, you might want to look at Ogre's "MovableObject::setRenderQueueGroup() " method.

HTH!

Re: Render overlay on top of cegui window

Posted: Thu Feb 18, 2010 19:56
by CrazyEddie
I think this might be because of the way I changed how we hook into the Ogre rendering process. Basically, we now use an Ogre::FrameListener and default to rendering after all other Ogre rendering is complete - always. This differs from earlier versions where we hooked into a render queue for a particular scene manager. The way it is now is (IMO) the way it should have always been - I think the only reason it wasn't that way previously was due to a lack of understanding of Ogre (I'm still no expert, but have picked up a few things over the years!).

Ok. So how can you achieve what you need to do then? The absolute key here is to understand that the automatic calling of CEGUI::System::renderGUI within CEGUI::OgreRenderer is just the default behaviour and that it's perfectly possible to disable that (via OgreRenderer::setRenderingEnabled) and set up your own listener of some kind and call System::renderGUI whenever you desire - using such a technique, it would be possible to go back to the old behaviour - or some other behaviour entirely - and have the CEGUI rendering sandwiched between layers of other Ogre rendering.

HTH

CE.

Re: Render overlay on top of cegui window

Posted: Fri Feb 19, 2010 15:53
by ianstangoe
Hi Eddie,

can the approach you described above be used to render the gui in multiple viewports?

Thanks,

Re: Render overlay on top of cegui window

Posted: Fri Feb 19, 2010 19:16
by CrazyEddie
ianstangoe wrote:can the approach you described above be used to render the gui in multiple viewports?

If you mean rendering the same sheet / layout, replicating the behaviour of the 0.6.x - and earler - series of releases, then I believe the technique should successfully replicate that behaviour - just set up a Ogre::RenderQueueListener and attach it to the appropriate place and it should cause the System::renderGUI to be called for all viewports. You could, if you wanted, just use the CEGUIRQListener from the old renderer module code - that should ensure the old behaviour is reproduced exactly ;)

If, instead, you meant different sheets / layouts for different view ports, then this is something that is planned to become a 'first class citizen', but we're not there yet (should be done in 0.7.something - though I'm currently focussed on the skin editor). It may be possible to 'fake' this with a combination of the above technique and switching the sheets between calls, as well as various techniques using multiple CEGUI::RenderingRoot objects and other such hackery ;) (the second approach is how we'll do it eventually, and is why many of those underlying parts exist).

CE.

Re: Render overlay on top of cegui window

Posted: Sun Feb 21, 2010 13:15
by ianstangoe
Ah ha, I was talking about duplicating in multiple viewports so looks like I can do that already, great! :D

Re: Render overlay on top of cegui window

Posted: Wed Feb 24, 2010 12:25
by ianstangoe
Hi Eddie,

I tried to implement this by creating my own RenderQueueListener and calling System::renderGUI() from within it, but I get a _beginFrame() crash presumably because its called from within a beginFrame() block started by OGRE :?

Have I got your suggestion wrong somewhere or is it that I'd have to close the OGRE rendering prior to calling renderGUI() now?, the previous version didn't directly interface with the rendersystem...

Thanks.

Re: Render overlay on top of cegui window

Posted: Wed Feb 24, 2010 13:20
by CrazyEddie
Ah, yeah. This will indeed be the case - hadn't thought of that :roll: It's easily worked around by means of a setting, though before that's added I think my best approach would be to come up with a test app so that I can confirm that this will work for sure (or at least give me some idea of what I'm talking about). As ever, watch this space, and in a few days or so there should be a workable solution (probably be the weekend) - so you can be up and running :)

CE.

Re: Render overlay on top of cegui window

Posted: Wed Feb 24, 2010 14:04
by ianstangoe
Coolio, we really need it because we work in stereo and our apps use menu systems to navigate around, so its the only thing preventing me from upgrading, I'm itching to upgrade asap!! :lol:

Re: Render overlay on top of cegui window

Posted: Wed Feb 24, 2010 20:39
by CrazyEddie
Firstly, apologies to wizzler - we seem to have hijacked your thread :oops:

With regards to the dual / multi viewport support, I have done some preliminary tests, and stuck up a video of what I've done in a hour or so this evening:



As the video description on YouTube says, we're not quite there yet as each viewport's content should be compressed in the x so that the window only fills half the available width. One of the mods needed to get this to work actually amounts to a bug fix, so that's good :D

CE.

Re: Render overlay on top of cegui window

Posted: Wed Feb 24, 2010 22:27
by ianstangoe
Yes sorry wizzler, but thats fantastic work already, exactly what I'm looking for, minus the scaling issue :wink:

Your solution should allow what wizzler wants also I presume :?:

Re: Render overlay on top of cegui window

Posted: Thu Feb 25, 2010 09:50
by CrazyEddie
ianstangoe wrote:Your solution should allow what wizzler wants also I presume :?:

Providing I understood the original question correctly, my first response should have solved that.

CE.

Re: Render overlay on top of cegui window

Posted: Thu Feb 25, 2010 10:06
by ianstangoe
Isn't the issue that you can't simply
set up your own listener of some kind and call System::renderGUI whenever you desire

because it hooks directly into the rendersystem :?

But, if it all works then thats all that matters :D

Thanks, CE.

Re: Render overlay on top of cegui window

Posted: Thu Feb 25, 2010 10:12
by CrazyEddie
:lol:

Yeah, probably. I forgot about that particular problem when I wrote the reply. However, it actually seems it may depend upon which render system you're using with Ogre - from what I've seen so far it does not affect OpenGL.

CE.

Re: Render overlay on top of cegui window

Posted: Thu Feb 25, 2010 11:01
by ianstangoe
Ah right, I'm using DirectX of course :lol: