Page 1 of 1

resizing Ogre Viewport interfers with CEGUI

Posted: Sun Feb 15, 2009 12:00
by Lastmerlin
Hi,

my problem is as follows: When the players opens some ingame Windows (inventory, Character info etc), they use up about 50% of the screen (left or right side). So half of the game world is blocked from the players view.
I got the proposal, that if such a window is opened and covers for example the left side of the screen, I should change the viewport, so that the game world is rendered only to the right side. By doing so, you should be able to continue playing (though with reduced sight) when some windows are opened.

The code is simple:

Code: Select all

m_viewport->setDimensions(0.5,0,1,1);
m_camera->setAspectRatio(Ogre::Real(m_viewport->getActualWidth()) / Ogre::Real(m_viewport->getActualHeight()));



What happens is: CEGUI renders to the reduce viewport, so that the window that should cover the left is placed on the right, too. It seems that changing the viewport affects CEGUI as well.

My code of the creation of the cegui_renderer:

Code: Select all

CEGUI::OgreCEGUIRenderer(
  m_window,   
   Ogre::RENDER_QUEUE_OVERLAY,
   false,
   3000,   
m_scene_manager);

This is done before the viewport is created. I have no Idea how CEGUI choses its viewport for rendering.

Please give me some advice.
Thanks alot.

Posted: Mon Feb 16, 2009 10:00
by CrazyEddie
Hi,

I think CEGUI will target all viewports for the scene manager that it's hooked into. You could try messing about with >1 scene manager, or alternatively, disable overlays during the rendering phases where yo do not want CEGUI to be drawn.

This whole deal is a little shitty to be honest. Hopefully my next attempt will be better :lol:

CE.

Posted: Tue Feb 17, 2009 12:20
by Lastmerlin
Hmm I think I will add this feature request to the *we'll deal with this later - eventually* - list then :lol:

It doesnt sound theres a simple and elegant solution, and I dont want to use too much time on hacking it together.

Thank you.

Posted: Wed Feb 18, 2009 12:13
by CrazyEddie
Yeah, I'm not certain myself to be honest (and I wrote the thing!).

As I have been looking again at the rendering mechanism for Ogre, the way we're currently hooking in, while convenient and working in most cases, has the potential for causing issues such that you're seeing here.

For the 0.7.0 version renderers, I'm going to try and do things slightly differently which should allow more control over this (though it all depends on finding an appropriate solution, of course).

CE.