Re: penalty for double buffering

Steven Jenkins wrote:
Michael Torrie wrote:

On Sat, 2003-12-13 at 13:43, Steven Jenkins wrote:
It seems to me that since you're drawing to the screen 50 times a second
that double buffering would buy you nothing anyway.  Double buffering is
mainly to eliminate flickering when the widget redraws or changes size. Since you're drawing yourself, with double buffering on, it seems to me
that you'd be drawing to the buffer and then to the screen.  Since
you're taking it upon yourself to handle all the invalidate events, such
a middle buffer isn't necessary (and won't do anything for you).  So
turning off the buffering returns you to the speeds you were used to
under gtk 2.0, and I don't think there would be much flickering.

The rate at which the display is updated is determined by the user. The application is a real-time data acquisition package with an interpreter for a small programming language. The graphics primitives are there if the user wants to draw plots, etc. 50 Hz is the likely uppper limit of user requirements, but higher and lower rates are allowed. Sometimes the users only update every few seconds.

But you may be right. I don't notice any flicker in the testing I've done so far. The widget can't be resized, so maybe I don't need the double buffering anyway. I'd like to be sure before I remove it.

Even if I don't need it, I'm still curious why it's so costly.

Make a timer with timer=g_timer_new(), then put things like t0=g_timer_elapsed(timer)
everywhere in the code, then have: g_printf("Time: %f %f %f\n",t3-t2,t2-t1,t1-t0)
in the 50Hz loop somewhere.

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