[GtkGLExt] Performances issues (GTK 2.6.4 / Win32, GtkGlExt, custom main loop)



Hello,


The following message was posted earlier in gtk-app-devel list,
but getting no answer, I thought I could repost to this list.

Also I have an additionnal question: when settuping a GL widget
you give it a 'gboolean direct' parameter, described as following
in documentation:

	direct : whether rendering is to be done with a
                 direct connection to the graphics system.

I set it to TRUE in my application, but then later call to
gdk_gl_context_is_direct() with the GdkGLContext returns FALSE.

I noticed in the Win32 code that this function always returned
FALSE. Does this mean that direct rendering is not supported
under Win32?

I don't know much about internal of GL/GtkGlExt, but I suppose
this could be a big performance hogger.

Any idea?

Thank you,

Omar Cornut


Following is my original post to gtk-app-devel mailing list:

//

Hello,


I'm having huge performance issues using GTK under Win32,
that were bereable so far but are becoming very problematic
today. Either GTK is very slow either we're doing something
wrong (I hope).

The problem is that I cannot locate the exact reason of those
performances issues. It could be Win32, this specific version
of GTK, GtkGlExt, the way we run our mainloop, the way I setup
my widgets, etc.

So I'll give a general introduction, in the hope that some of
you could spot a common problem or assist me in improving the
thing. Sorry if some parts are unclear.


Summary:
- Updating a few simple widgets in main loop knock framerate
  down by a more than signifiant amount.


Our setup:
- Installed 2.6.4 precompiled package from:
  http://gladewin32.sourceforce.net/
  Contains GTK+ 2.6.4, associated glib, pango, etc.
- Along with GtkGLExt 1.0.6 from:
  http://gtkglext.sourceforge.net/
- Compiling with MSVC 7.1.
- Computer: Pentium 4, 3000 Mz, 1 GB RAM, Radeon 9800 Pro
  video card with proper drivers installed.
- Operating system: Windows XP SP2.


We we do:
- I have a C++ program running a mainloop.
  The mainloop periodically call gtk_main_iteration_do()
- Single threaded
- The interface itself is a screen filling application
  with 2 OpenGL areas (using GtkGLExt) and various
  GTK widgets on all sides.
- The application shows information in widget that gets
  updated in realtime (say, 60 times per second).

I made a capture so you can get an idea of how it looks like:
  http://www.miracleworld.net/misc/code/gtktool-20051017-01.png


Mainloop is something like:
  initialize interface, create widgets, etc.
  while (!user_asked_to_quit)
  {
      gtk_main_iteration_do(FALSE);

      update logic; // This sets the value of various widgets

      gdk_gl_drawable_gl_begin(gl_area);
      // gl drawing...
      gdk_gl_drawable_gl_end(gl_area);
  }


What takes times:

1. In picture you can see a dozen of GtkSpinButton on the left
side. Whenever one of them gets its value changed in the main
loop - using gtk_spin_button_set_value() - frame rate goes
down. To get you an idea, I get from ~180 to ~40 FPS by updating
two (2) of those widgets in the mainloop. Updating more widgets
gets me even slower frame rate.


2. I have a GtkStatusBar in the bottom.
Calling gtk_statusbar_pop()/gtk_statusbar_push() on each main
loop iteration also make the framerate drop from ~180 to ~100 FPS.


The closest reference I could find is in this mailing list
thread, posted in 2003 and coincidentally related to GtkGlExt:
http://mail.gnome.org/archives/gtk-app-devel-list/2003-November/msg00046.html

I tried to remove my GL drawing area and got the same problem,
so I don't think it's related to GL. I am under the impression
that few application have auto-updating widgets so it may be
an uncommon case to notice those performances problems.


Questions:

- It is normal, accepted GTK behavior?
- I am doing something obviously wrong, or do you have any
  suggestion or what I should check or refer to?
- Do you have pointers to similar application that could refresh
  their Gtk widgets on a regular basis?



Thank you greatly,

Omar Cornut





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]