z ordering of elements

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

bishopnator
Just popping in
Just popping in
Posts: 1
Joined: Thu Aug 06, 2009 10:28

z ordering of elements

Postby bishopnator » Thu Aug 06, 2009 10:40

Hi, I am workging with CEGUI in ogre and I debugged rendering of all elements with NVPerfHUD. I tried only simple window with 10 icons (image + text) and rendering is not very good. Triangles are sent to GPU in following order: icon #1, text #1, icon #2, text #2, etc. Problem is caused by z-value of elements (not by OgreGUIRenderer class). I looked into CEGUI sources and it changes z value before rendering every element:

Code: Select all

/*************************************************************************
   Causes the Window object to render itself.
*************************************************************************/
void Window::render(void)
{
   // don't do anything if window is not visible
   if (!isVisible()) {
      return;
   }

   // signal rendering started
   WindowEventArgs args(this);
   onRenderingStarted(args);

   // perform drawing for 'this' Window
   Renderer* renderer = System::getSingleton().getRenderer();
   drawSelf(renderer->getCurrentZ());
///////////////////////////////////////////////////////////////////////////////////////////////////
   renderer->advanceZValue();
///////////////////////////////////////////////////////////////////////////////////////////////////

   // render any child windows
   size_t child_count = getChildCount();

   for (size_t i = 0; i < child_count; ++i)
   {
      d_drawList[i]->render();
   }

   // signal rendering ended
   onRenderingEnded(args);
}


Rendering can be optimized if all child elements will have same z-value. So if window contains 10 children, all should have same z-value. If they overlap, order of rendering is not determine, but it is not big deal in such cases. I am not sure if it is possible to fix it with current z-value handling, because rendering is recursive and advancing z-value not (variable is not stored in stack). I will try to fix this issue somehow in CEGUI but I think it is good idea to fix this to improve rendering performance.

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

Re: z ordering of elements

Postby CrazyEddie » Thu Aug 06, 2009 10:59

This whole approach to rendering has been replaced for the upcoming 0.7.0 release. Time spent optimising the renderers in old (0.6.2 and earlier) releases is time wasted.

Of course, I'm not suggesting the new renderer does not have issues - I'm working on some of those at the moment!

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests