## The scene graph

The first step in “drawing” a window is that GTK creates render nodes for all the widgets in the window. The render nodes are combined into a tree that you can think of as a scene graph describing your window contents.

Render nodes belong to the GSK layer, and there are various kinds of them, for the various kinds of drawing primitives you are likely to need when translating widget content and CSS styling. Typical examples are text nodes, gradient nodes, texture nodes or clip nodes.

In the past, all drawing in GTK happened via cairo. It is still possible to use cairo for drawing your custom widget contents, by using a cairo render node.

A GSK renderer takes these render nodes, transforms them into rendering commands for the drawing API it targets, and arranges for the resulting drawing to be associated with the right surface. GSK has renderers for OpenGL, Vulkan and cairo.