diff options
Diffstat (limited to 'src/opengl/util/fast_painter.glsl')
-rw-r--r-- | src/opengl/util/fast_painter.glsl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/opengl/util/fast_painter.glsl b/src/opengl/util/fast_painter.glsl new file mode 100644 index 0000000..63f5e5f --- /dev/null +++ b/src/opengl/util/fast_painter.glsl @@ -0,0 +1,19 @@ +// fast painter for composition modes which can be implemented with blendfuncs + +uniform sampler2D mask_texture; +uniform vec2 inv_mask_size; +uniform vec2 mask_offset; +uniform vec4 mask_channel; + +float mask() +{ + return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size)); +} + +void main() +{ + // combine clip and coverage channels + float mask_alpha = mask(); + + gl_FragColor = brush() * mask_alpha; +} |