The relationship between libraries: Clutter, Cogl, Clutter, GTK+, etc

7k views Asked by At

I'm a little confused about the relationship of the libraries listed above, here are what I think:

  1. Cairo is a 2D graphic library, and GTK+ uses it to render widgets. Cario is low-level.
  2. Cogl is a 3D graphic library based on OpenGL(or a fork? I don’t know), and Clutter is a 3D GUI toolkit based on Cogl.

If this is correct, will Clutter replace GTK+ someday?

And...

If you think there is a better place to ask this question or some books I should read first, please tell me! I'm self-learning programming for interest.

1

There are 1 answers

3
ebassi On BEST ANSWER

yes, Cairo is a high quality 2D drawing API, and GTK+ uses Cairo to draw itself.

Cogl is a GPU programming library that internally can use GL or GLES to access the graphics pipeline (though in theory it could as easily use DirectX on supported platforms).

Clutter uses Cogl for rendering, but it can also use Cairo for 2D elements.

Clutter will not replace GTK+: GTK+ is a very complex library that provides system integration, complex widgets, and other utility API that Clutter has no interest in providing.

the future is going to be a bit more gray than a black-and-white replacement.

Cairo can use Cogl to draw; Cogl will program the GPU pipeline, but Cairo will generate the geometry to be submitted, so you can have high quality 2D results. Cairo already can use GL directly, but Cogl has a better state tracking already.

Clutter can use GDK, the GTK+ windowing system API, to talk to the windowing system surfaces and get input events.

in the future, it's entirely possible that GTK+ will use Clutter internally as the base for its widgets - though that's still a work in progress.

in short, a diagram could be:


  GPU <- [ [ Cogl + Cairo ] <- [ GDK + Clutter ] <- GTK+ ] <- application