CEGUI and Ogre renderqueue query

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

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

CEGUI and Ogre renderqueue query

Postby ianstangoe » Mon Feb 14, 2011 10:43

Hi Team,

Code: Select all

14/02/2011 11:54:52 (Std)    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14/02/2011 11:54:52 (Std)    +                     Crazy Eddie's GUI System - Event log                    +
14/02/2011 11:54:52 (Std)    +                          (http://www.cegui.org.uk/)                         +
14/02/2011 11:54:52 (Std)    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

14/02/2011 11:54:52 (Std)    CEGUI::Logger singleton created. (03B05D30)
14/02/2011 11:54:52 (Std)    
14/02/2011 11:54:52 (Std)    ********************************************************************************
14/02/2011 11:54:52 (Std)    * Important:                                                                   *
14/02/2011 11:54:52 (Std)    *     To get support at the CEGUI forums, you must post _at least_ the section *
14/02/2011 11:54:52 (Std)    *     of this log file indicated below.  Failure to do this will result in no  *
14/02/2011 11:54:52 (Std)    *     support being given; please do not waste our time.                       *
14/02/2011 11:54:52 (Std)    ********************************************************************************
14/02/2011 11:54:52 (Std)    ********************************************************************************
14/02/2011 11:54:52 (Std)    * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
14/02/2011 11:54:52 (Std)    ********************************************************************************
14/02/2011 11:54:52 (Std)    ---- Version 0.7.5 (Build: Jan  6 2011 Debug Microsoft Windows MSVC++ 9.0 32 bit) ----
14/02/2011 11:54:52 (Std)    ---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
14/02/2011 11:54:52 (Std)    ---- XML Parser module is: CEGUI::RapidXMLParser - Official RapidXML based parser module for CEGUI ----
14/02/2011 11:54:52 (Std)    ---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
14/02/2011 11:54:52 (Std)    ---- Scripting module is: None ----
14/02/2011 11:54:52 (Std)    ********************************************************************************
14/02/2011 11:54:52 (Std)    * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *
14/02/2011 11:54:52 (Std)    ********************************************************************************

I'm using the old style RenderQueueListener approach for rendering my gui elements, however I've just come across an issue whereby if I set a unique renderqueue for the CEGUI stuff, it fails to render because that renderqueue doesn't get added to OGRE's list of 'active' renderqueues.

How do I get my CEGUI-only renderqueue to become active?

I tried calling System::renderGUI() after initialising but that didn't make any difference, is addRenderable() the key to activating renderqueue's in OGRE?

Thanks,

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

Re: CEGUI and Ogre renderqueue query

Postby ianstangoe » Mon Feb 14, 2011 12:01

Further to this,

I've come across some sort of bug where after calling renderGUI(), my viewport camera gets removed so no further rendering takes place in my renderQueueStarted() function!

I have the following code in my function:

Code: Select all

   RenderSystem* r = Root::getSingleton().getRenderSystem();
   Viewport* v = r->_getViewport();
   Camera* cam = v->getCamera();

   // Don't render anything on top viewport or if no camera setup!
   if ( !cam )
   {
      mSceneMgr->getRenderQueue()->getQueueGroup(queueGroupId)->clear();   
      return;
   }

The next renderqueue which calls this function immediately AFTER a call to renderGUI, drops into the if( !cam ){} block. :?

Any ideas whats going on?

Thanks.

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

Re: CEGUI and Ogre renderqueue query

Postby CrazyEddie » Wed Feb 16, 2011 08:00

I've got absolutely no idea what's going on :lol:

I think the first question is more Ogre related, and I'm not experienced enough with Ogre to be able to offer any kind of useful answer to that.

For the second question, after CEGUI is done rendering, I think it's likely one of CEGUI's Ogre::Viewport objects (without a camera) that is left attached to the render system. We should probably be saving / restoring the previous Viewport like a good citizen ;) I will raise a ticket for this.

CE.

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

Re: CEGUI and Ogre renderqueue query

Postby ianstangoe » Wed Feb 16, 2011 09:36

Hah,

Sounds like that's the issue, I was hoping you could shed some light on the first question, I'll post on the OGRE forums for that, I'll see if the old CEGUIRQListener will port straight across and see if that fixes anything..

Regarding the second issue, its a bit strange as when there's only a single viewport it seems to render okay, its only when I use a dual-viewport setup that it throws up that problem, when I debug it the viewport definitely isn't any that I've created but its the same one every frame.

Thanks CE.

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

Re: CEGUI and Ogre renderqueue query

Postby ianstangoe » Thu Feb 17, 2011 11:46

Hi CE,

I've solved the non-rendering issue of the gui elements with the following command:

Code: Select all

mSceneManager->getRenderQueue()->getQueueGroup(id);
this will create a renderqueuegroup of the specified index so that a renderQueueStarted() callback is issued for that queue group.

I've still got the viewport/camera bug though, so any rendering after the gui still bombs out :(

Gonna see if I can trace it :wink:

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

Re: CEGUI and Ogre renderqueue query

Postby CrazyEddie » Thu Feb 17, 2011 12:48

Ok, the problem is basically here: http://crayzedsgui.hg.sourceforge.net/h ... t.cpp#l113

You can see in CEGUI::OgreRenderTarget::activate we set a viewport directly, but in the function CEGUI::OgreRenderTarget::deactivate we are not doing anything. The correct thing to do would be to save the old viewport in activate and then restore it in deactivate. This said there could be issues with other states that CEGUI changes - though I'm not certain about this.

CE.

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

Re: CEGUI and Ogre renderqueue query

Postby ianstangoe » Thu Feb 17, 2011 15:44

Hah, funny you should mention that :wink:

I implemented the code to reset things but it doesn't work, the mouse is drawn outside the activate/deactivate calls and therefore picks up the pre-gui view matrices, however I moved the storing and resetting of the rendersystem to CEGUIOgreRenderer::beginRendering()/endRendering() and that seems to work okay. I've created a patch file against the latest trunk in mecurial, I think, I'll upload it to the patch tracker. :)

I've uploaded a patch file here: http://www.cegui.org.uk/mantis/view.php?id=430, hopefully I've done it correctly but if not it should show my additions, affects only one cpp file..

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

Re: CEGUI and Ogre renderqueue query

Postby CrazyEddie » Sun Feb 20, 2011 10:03

Thanks for the patch, I will look it over and commit soon :) You are of course correct that the save/restore is better done at the higher CEGUI::Renderer level than the lower level that I suggested ;)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests