ArticleslgStudy

science

GTK Scene Graph Kit

GTK Scene Graph Kit is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GTK Scene Graph Kit rather than just read about it. In short: GTK Scene Graph Kit (GSK) is the rendering and scene graph API for GTK introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering.

GTK Scene Graph Kit — main illustration
GTK Scene Graph Kit — illustration

Key takeaways

  • GTK Scene Graph Kit belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GTK Scene Graph Kit to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GTK Scene Graph Kit from memory before moving on to harder problems.

Reference excerpt

GTK Scene Graph Kit (GSK) is the rendering and scene graph API for GTK introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering. Like GDK, GSK is part of GTK and licensed under the GNU Lesser General Public License (LGPL).

Rationale GSK is part of GTK. GSK is meant to be used by GTK itself and by GTK-based applications that wish to replace Clutter for their UI. Applications that made use of Clutter instead of using only GTK are e.g. GNOME Shell, GNOME Videos, GNOME Boxes and Cheese. Any application which makes use of GTK's graphical control elements (widgets), as opposed to those applications getting a GTK window and then drawing themselves on it, benefit from GSK.

Performance Drawing graphical control elements (widgets) without a scenegraph leads to rendering things that don't show up on the screen, things that do not need to be rendered; hence it leads to avoidable performance and battery life losses. The scenegraph is used to do hidden surface determination.

Simplicity The way widgets were drawn in GTK (when not using Clutter), was, that a draw function (part of GDK hence the name (GIMP "Drawing" Kit)) drew everything. There was no way to know, what has just been drawn. To know where the mouse pointer was currently hovering over, the current position had to be computed. With GSK, it should be fairly easy to write complex graphical control elements (widgets) and still track easily the whereabout of the mouse pointer.

CSS It was decided for GTK to move to a Cascading Style Sheet (CSS)-based model for how graphical control elements (widgets) are styled (i.e. themed/skinned) and rendered. In CSS, shadows, borders, padding and style properties have well-defined semantics. Some of those semantics are difficult to implement with the old GTK drawing model. GSK makes use of graphene, an external library which houses a collection of geometry types — points, sizes, rectangles, vectors, quads, quaternions, matrices. Graphene has been ported to the Meson build system.

GSK rendering pipeline GSK uses a dual-layer approach:

The lower layer is a simple rendering tree of operations; it can be transformed into appropriate rendering commands with minimal state changes, so it gets transformed into the rendering pipeline. The tree of rendering operations is represented by GskRenderNode instances; an instance of GskRenderer takes the render nodes and submits them (after potentially reordering and transforming them to a more appropriate representation) to the underlying graphic system. higher layer: a complex set of logical layers; it adds a high level convenience API for application developers.

Rendering APIs As of GTK 3.90, which is the development version number of what will become GTK 4, GSK supports rendering using these back-ends:

Cairo OpenGL Vulkan

History

Clutter Clutter was released to the public on June 22, 2006. The integration library "clutter-gtk" has been available since 2006-11-29. At the 2nd Desktop Summit in August 2011 in Berlin there was quite some talk regarding "GTK+ 4.0 and Clutter 2.0".

Idea to introduce a scene graph to GTK In 2008 developers such as Havoc Pennington were considering to add a scene canvas to GTK, as people outside of GTK were making use of things like Clutter, Pigment, HippoCanvas or GooCanvas. It was proposed to make graphical control elements (widgets) one kind of object in a more flexible scene graph.

GSK Before GSK, drawing used to be done by GDK - handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality. In June 2006 Clutter, an OpenGL-based 'interactive canvas' library, was released. Clutter has its own scene graph, and GNOME developers preferred to use Clutter's scene graph with GTK, facilitated by a library called clutter-gtk. Clutter can be embedded into every GNOME application by using the clutter-gtk library. The clutter-gtk library provides a GtkClutterEmbed GTK widget which can be used to display a ClutterStage. Some thought went into how to merge Clutter and GTK in a better way than the clutter-gtk library. In 2011, Firefox introduced "Azure" and Joe Drew and Bas Schouten bothered with some explanations.

At GUADEC2013 in Brno Emmanuele shared his idea on implementing a scene graph and an animation framework inside the GNOME platform (after working for the past 6 years on Clutter). GTK Scene Graph Kit (GSK) is the forthcoming scene graph for GTK in the process of being written by Emmanuele Bassi. On 30 July 2014, Emanuelle stated that he thought there shouldn't be a stand-alone Clutter 2.0. There was a presentation at the 2014 Developer Experience Hackfest regarding a new scene graph for GTK aimed at being merged into GTK+ 3.16. Then GSK was planned to be ready and fully integrated into GTK+ version 3.20, to be released in March 2016. This was postponed to 3.22, and then finally merged into 3.90. Having OpenGL (or OpenGL ES) support in GDK facilitates a slightly better control of the graphics pipeline; OpenGL is well suited for compositing textured data but totally unsuited for drawing. The latest information about the status of GSK is from GUADEC 2016.

Other projects Enlightenment Foundation Libraries has been using a scene graph since 2000, implemented in the Evas library. Qt has been redesigned, and starting with version 5, it features Qt Quick 2 with scenegraph based rendering.

See also

Clutter

References

External links GNOME Reference Manual for GSK4 unstable GSK at wiki.gnome.org GSK Demystified (I), (II), (III) – Emmanuele Bassi, 2016/08 GSK code from release GTK 3.89.5 The modern Gtk drawing model – Alexander Larsson, 2013/11/04 Overview of GTK and its Libraries Archived 2019-03-12 at the Wayback Machine - The GTK Project https://git.gnome.org/browse/gtk-web/plain/images/architecture.svg https://wiki.gnome.org/Projects/Clutter https://wiki.gnome.org/Projects/Clutter/Future https://wiki.gnome.org/Projects/Clutter/Apocalypses https://wiki.gnome.org/Projects/Clutter/Roadmap

Illustrations

GTK Scene Graph Kit: Simplified software architecture of GTK in 2014.
Simplified software architecture of GTK in 2014.
GTK Scene Graph Kit: CSS taxonomy.
CSS taxonomy.

Worked examples

Example 1 — a first encounter with GTK Scene Graph Kit

Start with the simplest possible case. Write down what GTK Scene Graph Kit claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GTK Scene Graph Kit before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GTK Scene Graph Kit ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GTK Scene Graph Kit

In research
GTK Scene Graph Kit appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GTK Scene Graph Kit in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GTK Scene Graph Kit is common in secondary-school and first-year university syllabi. It links to neighbouring topics GTK, Graphics libraries, so understanding it makes those chapters shorter.
In everyday life
Look for GTK Scene Graph Kit outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “GTK Scene Graph Kit” →

How to study GTK Scene Graph Kit in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GTK Scene Graph Kit means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GTK Scene Graph Kit out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GTK Scene Graph Kit in simple terms?

GTK Scene Graph Kit (GSK) is the rendering and scene graph API for GTK introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering.

Why does GTK Scene Graph Kit matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GTK Scene Graph Kit?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GTK Scene Graph Kit.

Tags

  • GTK
  • Graphics libraries

Keep exploring