From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Date: Fri, 15 Sep 2000 08:47:52 +0000 From: Elliott Hughes Message-ID: <39c1db14@news.core.genedata.com> References: <20000915020412.AA23219A01@mail> Subject: Re: [9fans] new versions of graphics programs? Topicbox-Message-UUID: 07ec1a48-eac9-11e9-9e20-41e7f4b1d025 "Russ Cox" wrote in message news:20000915020412.AA23219A01@mail... > I admit to not understanding the > appeal of double-buffering, especially > the claim that it is more efficient. it's not really an efficiency thing, but it does help make your program look more snappy. the usefulness of double-buffering is that you don't get caught with your pants down: the user will never see a half-finished display. as you say, there's more work to be done, but the point is that you're making the deadline easier to meet. you don't have to synchronize yourself with the screen refresh and you don't have to get your drawing done before the next refresh. the interesting question is where to do the double-buffering, at what granularity. if you have a container, is it worth double-buffering each of its sub-components separately if they're only going to be 'drawn' into the double-buffered parent? is it worth working out whether you need double-buffering on a particular repaint? do you end up deciding you may as well have one buffer per top-level window and do all your drawing into that? last time i looked at GTK+, which i admit was a while ago, it wasn't using double-buffering, and it looked terrible. particularly with a window manager supporting opaque reshaping (i.e. the window changes all the time, rather than making you guess from a rubber-band outline whether it would now look the way you want, were you to stop rubber-banding). i haven't seen such flicker in a long time. it doesn't matter how efficient your repainting is, you're almost certain to look spastic if you don't double-buffer. > To me, it > seems like a software solution to a > hardware problem. you can say that about anything. this trade-off is ever-present. but until all hardware is able to remove the need for double-buffering, double-buffering is very useful indeed. double-buffering may seem a waste of time, but speaking as a pragmatist, i know i wouldn't want to live without it. (nor even do it myself; i'd rather have it done for me, as it is in Java.) - Elliott