Render overlay on top of cegui window

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

User avatar
wizzler
Just popping in
Just popping in
Posts: 10
Joined: Sat Jan 30, 2010 15:28

Render overlay on top of cegui window

Postby wizzler » Thu Feb 18, 2010 12:55

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?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: Render overlay on top of cegui window

Postby scriptkid » Thu Feb 18, 2010 17:39

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!
Check out my released snake game using Cegui!

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Thu Feb 18, 2010 19:56

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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Fri Feb 19, 2010 15:53

Hi Eddie,

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

Thanks,

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Fri Feb 19, 2010 19:16

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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Sun Feb 21, 2010 13:15

Ah ha, I was talking about duplicating in multiple viewports so looks like I can do that already, great! :D

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Wed Feb 24, 2010 12:25

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.

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Wed Feb 24, 2010 13:20

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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Wed Feb 24, 2010 14:04

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:

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Wed Feb 24, 2010 20:39

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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Wed Feb 24, 2010 22:27

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 :?:

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Thu Feb 25, 2010 09:50

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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Thu Feb 25, 2010 10:06

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.

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

Re: Render overlay on top of cegui window

Postby CrazyEddie » Thu Feb 25, 2010 10:12

: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.

ianstangoe
Quite a regular
Quite a regular
Posts: 79
Joined: Wed Jan 09, 2008 11:06

Re: Render overlay on top of cegui window

Postby ianstangoe » Thu Feb 25, 2010 11:01

Ah right, I'm using DirectX of course :lol:


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 13 guests