Re: Quick redraw in a plot



Alexandre wrote:
  Hi,

  I creating something like a osciloscope, with gtk on Linux.
  I've created a plotting widget to plot the data collected. So, I have to redraw this plotting widget very 
quickly to show the data (witch changes very quickly).
There is one thread (separeted form the main thread) wich do the data acquisition, and then call gtk_widget_queue_draw(xyplot) to redraw the widget. But there is one problem, sometimes, when I call this function the widget is not redrawn.. I think the main loop doesn't process it. So is there a way that I can be sure that I'm redrawing the widget? and do it in a very high frequency?


I doubt that you need your data to be rendered faster than the eye can see,
in which case, the general gtk+ double-buffered rendering techniques should
be adequate for your application.

When you call gtk_widget_queue_draw(), you are enqueueing a "draw" request
in the event queue - assuming that you dont do anything blocking in your
code and always return quickly from your callbacks - you wont have any
"unresponsiveness" or drawing latency (except under heavy system loads
ofcourse).

So I think that:

    a.) you should ensure that there are no lengthly calculations or
        blocking operations in your code (i.e. make sure you are not
        hijacking the main loop, always return to it).
    b.) if you really need better animated performance - you can look into
        disabling double-buffering for your widget, this can be a little
        complex (I cant give you all the details 'cause I'd have to
        research them myself :-P )

Cheers,
                  -Tristan



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