GTK+ Scene Graph Kit
   HOME

TheInfoList



OR:

GTK Scene Graph Kit (GSK) is the rendering and scene graph API for
GTK GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
introduced with version 3.90. GSK lies between the graphical control elements (widgets) and the rendering. Like
GDK GDK (GIMP Drawing Kit) is a Library (computing), library that acts as a Wrapper pattern, wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the display server and the GTK library, ...
, GSK is part of GTK and licensed under the
GNU Lesser General Public License The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
(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 Clutter and its derivations may refer to any of the following: Excessive physical disorder * Clutter, a confusing, or disorderly, state or collection, and possible symptom of compulsive hoarding * Clutter (marketing), numerous advertisements, a ...
for their UI. Applications that made use of Clutter instead of using only GTK are e.g.
GNOME Shell GNOME Shell is the graphical shell of the GNOME desktop environment starting with version 3, which was released on April 6, 2011. It provides basic functions like launching applications, switching between windows and is also a widget engine. ...
,
GNOME Videos GNOME Videos, formerly known as Totem, is a media player (audio and video) for the GNOME computer desktop environment. GNOME Videos uses the Clutter and GTK+ toolkits. It is officially included in GNOME starting from version 2.10 (released in ...
,
GNOME Boxes GNOME Boxes is an application of the GNOME Desktop Environment, used to access virtual systems. Boxes uses the QEMU, KVM, and libvirt virtualization technologies. GNOME Boxes requires the CPU to support some form of hardware-assisted virtual ...
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 In 3D computer graphics, hidden-surface determination (also known as shown-surface determination, hidden-surface removal (HSR), occlusion culling (OC) or visible-surface determination (VSD)) is the process of identifying what surfaces and parts o ...
.


Simplicity

The way widgets were drawn in GTK (when not using Clutter), was, that a draw function (part of
GDK GDK (GIMP Drawing Kit) is a Library (computing), library that acts as a Wrapper pattern, wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the display server and the GTK library, ...
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 Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technol ...
(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 Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comp ...
. 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 Meson () is a software tool for automating the building (compiling) of software. The overall goal for Meson is to promote programmer productivity. Meson is free and open-source software written in Python, under the Apache License 2.0. Intero ...
.


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 Cairo ( ; ar, القاهرة, al-Qāhirah, ) is the Capital city, capital of Egypt and its largest city, home to 10 million people. It is also part of the List of urban agglomerations in Africa, largest urban agglomeration in Africa, List of ...
* OpenGL *
Vulkan Vulkan is a low- overhead, cross-platform API, open standard for 3D graphics and computing. Vulkan targets high-performance real-time 3D graphics applications, such as video games and interactive media. Vulkan is intended to offer higher perfor ...


History


Clutter

Clutter Clutter and its derivations may refer to any of the following: Excessive physical disorder * Clutter, a confusing, or disorderly, state or collection, and possible symptom of compulsive hoarding * Clutter (marketing), numerous advertisements, a ...
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 Robert Sanford Havoc Pennington (born c. 1976) is an American computer engineer and entrepreneur. He is known in the free software movement due to his work on HAL, GNOME, Metacity, GConf, and D-Bus. History Havoc Pennington graduated from th ...
were considering to add a scene canvas to GTK, as people outside of GTK were making use of things like
Clutter Clutter and its derivations may refer to any of the following: Excessive physical disorder * Clutter, a confusing, or disorderly, state or collection, and possible symptom of compulsive hoarding * Clutter (marketing), numerous advertisements, a ...
, Pigment
HippoCanvas
o
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),
cursor Cursor may refer to: * Cursor (user interface), an indicator used to show the current position for user interaction on a computer monitor or other display device * Cursor (databases), a control structure that enables traversal over the records in ...
s, fonts, as well as window events and
drag-and-drop In computer graphical user interfaces, drag and drop is a pointing device gesture in which the user selects a virtual object by "grabbing" it and dragging it to a different location or onto another virtual object. In general, it can be used to ...
functionality. In June 2006
Clutter Clutter and its derivations may refer to any of the following: Excessive physical disorder * Clutter, a confusing, or disorderly, state or collection, and possible symptom of compulsive hoarding * Clutter (marketing), numerous advertisements, a ...
, 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 Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current ...
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 Emanuele 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 OpenGL for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accele ...
) support in
GDK GDK (GIMP Drawing Kit) is a Library (computing), library that acts as a Wrapper pattern, wrapper around the low-level functions provided by the underlying windowing and graphics systems. GDK lies between the display server and the GTK library, ...
facilitates a slightly better control of the
graphics pipeline In computer graphics, a computer graphics pipeline, rendering pipeline or simply graphics pipeline, is a conceptual model that describes what steps a graphics system needs to perform to  render a 3D scene to a 2D screen. Once ...
; 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 The Enlightenment Foundation Libraries (EFL) are a set of graphics libraries that grew out of the development of Enlightenment, a window manager and Wayland compositor. The project's focus is to make the EFL a flexible yet powerful and easy to ...
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 Clutter and its derivations may refer to any of the following: Excessive physical disorder * Clutter, a confusing, or disorderly, state or collection, and possible symptom of compulsive hoarding * Clutter (marketing), numerous advertisements, a ...


References


External links


GNOME Reference Manual for GSK4 unstable

GSK at wiki.gnome.org
* GSK Demystifie
(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
- 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 {{GTK Graphics libraries GTK