Re: the right way to draw in a drawingarea



Foster, Gareth wrote:

the display flickers, even when drawing a simple square.


Doesn't this often mean you need to be double buffering?
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
This is a point I am completely unsure about. I haven't the foggiest on Gtk internals and the ramifications of a simple call such as draw_rectangle. I've used double buffering in both OpenGL and Java. I've just never really seen any real reference to it in gtk. Now that I've had a couple beers, I seem to rememeber some reference to getting an offscreen graphics context, drawing to that, and then switching the main gc with it back and forth. But I could be completely making that up. ( the beer )

Double buffering isn't really that hard of a concept. I'm just not sure of if its needed. Because its more than possible that gtk has its own buffering scheme burried somewhere. I've actually written a couple programs to animate image data using Gtkmm. I've never had a problem with flickering that wasn't because I was doing something silly like clearing and then redrawing. So the answer is I dunno. Its possible. If I get time I'll write a test program to try and play with the idea.

And if I had thought to take a moment to google something as silly as gtkmm double buffering, I would have noticed that the gtkmm docs specify that widgets are double buffered by default. In which case, no double buffering will not solve this problem cause its already being done. Which goes to show that yes, I was making up the graphics context thing. Must be something from java I was thinking of.
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Widget.html#a175

In other news, Unleashed wasn't half bad if anyone cares.

Cheers,
Paul



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