The relationship between libraries: Clutter, Cogl, Clutter, GTK+, etc
Asked Answered
B

1

23

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.

Borg answered 25/1, 2012 at 15:53 Comment(0)
L
47

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
Liberia answered 25/1, 2012 at 17:19 Comment(3)
To bring it home a little, if you are an app developer you might use gtk to create the window, menus, toolbars, etc and use clutter to draw any app content that is "drawing area like" and doesn't fit into the widget-based app metaphor. Within clutter, you may dig down to Cairo for specific drawing tasks.Igloo
And now that clutter is going to be retired, what will repace it?Psid
GTK4 and libadwaita are the replacement for pretty much the entire Clutter API.Liberia

© 2022 - 2024 — McMap. All rights reserved.