XCB, XLib and X extensions
I am trying to learn XCB (xcb.freedesktop.org), but due to lack of tutorials and examples I am forced to study XLib as well. Although I am done with the simple stuff, I have several problems.
The most important one (at the moment) is the flicker. X Extensions might have the solutions I need but, I can not seem to find a decent tutorial for (or even simple introduction to) specific X extensions, other than the man pages. Currently I am interested in XRender and XDBE(double buffer extension).
It looks like GTK, Qt etc are using XRender so I can study those(I am trying to figure out how they are doing flicker free drawing, well almost:), but for XDBE it is almost impossible (at least to me) to find information about it. It seems like no one is using it. Does any one know anything about XDBE? And why is its usage so limited?
I'm not sure what your question is.
Double buffering is indeed a good way to take care of "flicker" in animations. There are plenty of good web links and documentation on how to use Xlib's DBE, most X servers include DBE as a standard extension (you can use the command "xdpyinfo|less" to check yours), and it's easy to get DBE support if your server doesn't already have it. The "gotcha" is, if you code your app to require DBE, to make sure that all your users' X11 servers also have DBE support.
I happen to like Xlib, but I'm not sure it's the best programming interface to start with. It's definitely not the best tool for all jobs (Many jobs: yes. All jobs: no.)
You might also wish to explore Gtk+ 2.0 and Qt (both or which you mentioned), SDL and OpenGL (to name just a few). Most have a wealth of sample code, tutorials, and mail groups available to help you.
Good luck .. PSM
So if you happen to know any XRender and XDBE tutorials, help me.
1. I was hoping to find a good example in my library that I could cut/paste for you but, unfortunately, I don't have anything.
For whatever it's worth, this is an excellent book with TONS of sample code.:
Professional Graphics Programming in the X Window System
Eric F. Johnson, Kevin Reichard
MIS Press, 1993; ISBN 1-55828-255-6
It's been out-of-print for over 10 years, but you can still get used copies from Amazon for as little as $5.00 - $10.00 (USD). If you're genuinely serious about learning Xlib, I think it would definitely be a very, very good investment.
And just FYI, all of Chap 25 is devoted to Double Buffering (including complete sample code).
2. This is another excellent Xlib programming resource, and it, too has a double-buffering example:
3. Neither Johnson nor Kenton use XDBE per se.
They use a (relatively straightforward) technique where they allocate different Xlib color planes, and then simply alternate between one and the other planes.
When I googled for XDBE code, I got the same results you did: nothing! These two links are the best I was able to find:
4. The intent of my original post, however, was actually to *dissuade* you from trying Xlib for this particular project. I get a strong sense you might be better off with a higher-level library. One that'll do double-buffering (and a lot more!) for you automatically.
You mentioned GTK+ 2.0 and Qt; I added OpenGL and SDL. Any of these four would be a good choice.
I resisted suggesting too many alternatives, but I'd really like to add XForms (http://www.york.ac.uk/services/cserv...ics/xforms.htm) and FLTK (http://http://www.fltk.org/) to the list.
And in particular, I think you might enjoy this article in this month;s edition of "Linux Journal" (most of this month's issue is devoted to "Ruby"; it should be available on most news stands):
"Under-Ice Sonar Visualization", Richard R. Shell, Garner C. Bishop and Douglas B. Maxwell
'Hope that helps .. and good luck!
Your .. PSM
|All times are GMT -5. The time now is 11:03 AM.|