Disappearing Windows & Performance Problems

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

gtmacdonald@gmail.com
Just popping in
Just popping in
Posts: 8
Joined: Tue Mar 18, 2008 17:39

Disappearing Windows & Performance Problems

Postby gtmacdonald@gmail.com » Mon Apr 28, 2008 06:52

Hello,

I've been experimenting with cegui widgets to create an overhead map to track possibly hundreds of continuously updating entities. In the process I ran into a couple of issues.

I've created a new widget that's basically a radio button that displays a small icon. Then I parented a bunch of those to the background image of my overhead map. As a test, each frame I move the images around the map.

The first thing I noticed was that the setproperty method was killing my frame rate for just a few hundred or so entities.

Then I was surprised to find a limit to the number of icons I could create. After 967, gui elements start to disappear and reappear when I click the mouse around.

I'm very curious what's going on. Is it inappropriate to use cegui to display game entities? Is there a faster way to set the position? Also, is there a hard limit to the number of windows?

I'm using pyogre. These things happen with either opengl or the d3d renderer. I'm using Taharez.

Thx in advance.

-Greg

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Apr 28, 2008 12:28

Are you setting properties to the same value? This would kill performance as the Cegui cache cannot be used and would need to be recreated every time. Here's a concrete example of what I'm asking

Code: Select all

onProcessFrame()
{
  String currentValue;
  for(int i = 0; i < list.size(); i++)
  {
    currentValue = list[i]->getCurrentValue();
    list[i]->getCeguiHandle()->setText(currentValue);
  }
}


If this is the type of situation you are in then you need to only update Cegui widgets when they have actually changed:

Code: Select all

onProcessFrame()
{
  String currentValue;
  for(int i = 0; i < list.size(); i++)
  {
    if(list[i]->isModified())
    {
      currentValue = list[i]->getCurrentValue();
      list[i]->getCeguiHandle()->setText(currentValue);
      list[i]->setModified(false);
    }
  }
}

gtmacdonald@gmail.com
Just popping in
Just popping in
Posts: 8
Joined: Tue Mar 18, 2008 17:39

Postby gtmacdonald@gmail.com » Mon Apr 28, 2008 19:11

Thx for responding. :)

I'm trying to figure out the max number of moving units I could have in my overhead map. So the values are always changing. I'm wondering if this is an inappropriate use of cegui, and that maybe I'd be better off using ogre overlays directly.

gtmacdonald@gmail.com
Just popping in
Just popping in
Posts: 8
Joined: Tue Mar 18, 2008 17:39

Postby gtmacdonald@gmail.com » Tue Apr 29, 2008 10:20

So what does this cache do exactly? Do changes to one window cascade across the window hierarchy? If that's the case then is it possible to accumulate updates and do them all at once? Most gui toolkits I've come across have this feature. WxWidgets's freeze/thaw methods come to mind.

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

Postby CrazyEddie » Mon May 05, 2008 07:43

Hi,

The render cache system caches drawing operations; that is, not actual imagery but rather what to draw, where and how big.

Generally changes to one window should not cause all other windows to have to regenerate the cache. The only time this happens is when a parent window is resized; all child windows are then invalidated also.

The caches are not re-populated at the time they get invalidated but rather the next time the rendering function is called - so this in effect causes the cache updates to be batched together.

Hope this information is helpful.

CE.

gtmacdonald@gmail.com
Just popping in
Just popping in
Posts: 8
Joined: Tue Mar 18, 2008 17:39

Postby gtmacdonald@gmail.com » Mon May 05, 2008 18:56

Hi Eddie,

Thanks for the info, that's definitely good to know.

In case anyone's curious, I ended up rendering my overhead map using ogre with an orthographic camera and a separate scene manager, drawing the icons as textured quads. This wasn't as difficult as I expected. (Ogre's ManualObject class worked great for setting this up.) Doing it this way gives me a scene manager for object culling and quick hit-testing. After I've got my texture rendered I place it in a static image cegui window. So I still get to use cegui for everything else, which is very nice. :)

The only thing with this is that I'm going to have to handle drawing the icon states (like selection) myself.

Regards,
Greg


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests