Skip to content

Add support for GLShader nodes

Alexander Larsson requested to merge alexl/gtk:glshader-node into master

This adds support for a GLShader rendernode which is somewhat similar to a shadertoy snipped. I.e. it is a pure fragment shader that produces pixels given some inputs. The inputs is a vec4 that you can put whatever you want in, as well as up to 4 textures that are created by rendering RenderNodes (although if you have a texture already you can just put that in a texture render node and it will be used directly.

There is also a fallback node that is used for non-gl backends or whenever there is any kind of problem with the shader.

The useful thing about this vs GtkGLArea is that it can use render-nodes as input. This means we can do things that integrate with the gtk+ drawing hierarchy. For example we can do complex per-pixel blends between two child widgets, or apply some kind of filter to an entire widget hierarchy.

I want to add some nice looking demo in gtk-demo to show this of, but I have not had time to look at that yet. If you want to just test the code i have a really ugly hacky demo here:

Edited by Matthias Clasen

Merge request reports