Getting rid of mouse droppings

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

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Getting rid of mouse droppings

Postby dteviot » Mon Jan 01, 2007 04:17

Gentlemen,
Sorry to bother you, but I have a bit of a problem. I’m trying to get CEGUI# into a workable condition, and I’m a bit stuck. Specifically, how do I get rid of the “mouse droppings?” That is, when the mouse cursor moves across the screen, its old images are not removed. Looking at the CEGUI C++ code, I see this:

Code: Select all

void System::renderGUI(void)
{
   //////////////////////////////////////////////////////////////////////////
   // This makes use of some tricks the Renderer can do so that we do not
   // need to do a full redraw every frame - only when some UI element has
   // changed.
   //
   // Since the mouse is likely to move very often, and in order not to
   // short-circuit the above optimisation, the mouse is not queued, but is
   // drawn directly to the display every frame.
   //////////////////////////////////////////////////////////////////////////

   if (d_gui_redraw)
   {
      d_renderer->resetZValue();
      d_renderer->setQueueingEnabled(true);
      d_renderer->clearRenderList();

      if (d_activeSheet)
      {
         d_activeSheet->render();
      }

      d_gui_redraw = false;
   }

   d_renderer->doRender();

   // draw mouse
   d_renderer->setQueueingEnabled(false);
   MouseCursor::getSingleton().draw();

    // do final destruction on dead-pool windows
    WindowManager::getSingleton().cleanDeadPool();
}

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Tue Jan 02, 2007 15:25

That doesn't look like a CEGUI issue to me, but it seems you forgot to clear the screen before every frame.
I don't know what renderer you use, but in openGL you do it like this:

Code: Select all

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

and in DX I think you do it by calling the

Code: Select all

D3DDevice::Clear(...)

method. (DX is a long time ago for me :) )

You should add this line as the first line of your rendering function, before drawing anything.

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Postby dteviot » Tue Jan 02, 2007 19:14

OK, Let me clarify my previous statement.
The "mouse droppings" are left until the mouse does something like hover over a button. Then the trail is cleared, but while the mouse is hovering over the button it again leaves a trail. Which is cleaned up when the mouse moves off the button. And a new trail starts at the edge of the button.
Now, this code, suggests that CEGUI doesn't try redrawing the image each frame. So, I was hoping someone could tell me:
1. How CEGUI aviods the per frame redraw, and
2. How it does this without without leaving a trail of mouse droppings.

Thanks.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Tue Jan 02, 2007 21:03

OK, I see your problem, but I don't see a cause/solution :D maybe you can tell us wich renderer and wich version of CEGUI you use ? I use CEGUI 0.5 and OpenGL renderer and never had such problems. But to be honest, I use my own cursor not the CEGUI one.

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Postby dteviot » Tue Jan 02, 2007 22:10

This one:
http://ceguisharp.sourceforge.net/index.php/Main_Page
Which claims to be ported from Revision 1248
Version 0.4.?
Oh, and I'm using the XNA renderer.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Tue Jan 02, 2007 22:21

Ok now I'm sorry but i can't help you anymore :? I dont know C#, I never knew version 0.4 and i don't know what is XNA :) sorry.

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Postby dteviot » Wed Jan 03, 2007 22:06

Well, could you at least tell me:
1. How CEGUI aviods the per frame redraw, and
2. How it does this without without leaving a trail of mouse droppings.

That might give me some clues for what I need to be looking for.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Wed Jan 03, 2007 22:25

I'm afraid I can't :( I only use CEGUI for a few month

dteviot
Just popping in
Just popping in
Posts: 15
Joined: Mon Nov 13, 2006 19:26

Postby dteviot » Thu Jan 04, 2007 04:22

Most embarassing. I’m having a major “D’oh” moment.
After looking at the CEGUI code some more I realize that

Code: Select all

activeSheet.Render();

DOESN’T render the screen. It just generates the set of sprite quads that are to be rendered.
The drawing of the quads occurs in the line

Code: Select all

renderer.DoRender();


So, the problem I’m having is that XNA isn’t clearing the screen each frame. (In fact, possibly it’s not even redrawing the quads.)

So, I'm now off to XNA forums to find out under what conditions GraphicsDevice.Clear() does not work.

Thanks for your time.

Also, might I suggest that:
  • The above Render() function is badly named, and should be something like GenerateQuads(), and
  • The comment should be something more helpful? Like, “if no control has changed, don’t bother calculating the list of Quads to render”

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sat Jan 06, 2007 02:35

hope you'll find a solution ;)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 0 guests