aboutsummaryrefslogtreecommitdiffstats
path: root/shaders/rect.frag
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-07 18:30:28 +0100
committerDavid Robillard <d@drobilla.net>2019-12-11 23:06:47 +0100
commit642b1d97ba8ed6bce9a29c7b7988ab27b98e9219 (patch)
tree04a2283c23e16d76e408193e7e791d231314a1b7 /shaders/rect.frag
parent13f9ef04aaf5f3583ef83bffc094758f0d640634 (diff)
downloadpugl-642b1d97ba8ed6bce9a29c7b7988ab27b98e9219.tar.gz
pugl-642b1d97ba8ed6bce9a29c7b7988ab27b98e9219.tar.bz2
pugl-642b1d97ba8ed6bce9a29c7b7988ab27b98e9219.zip
GL3 Test: Calculate border color on the GPU
Diffstat (limited to 'shaders/rect.frag')
-rw-r--r--shaders/rect.frag18
1 files changed, 9 insertions, 9 deletions
diff --git a/shaders/rect.frag b/shaders/rect.frag
index d128f37..cb25bed 100644
--- a/shaders/rect.frag
+++ b/shaders/rect.frag
@@ -11,7 +11,6 @@
hardcoded, but could be made a uniform or vertex attribute easily enough. */
uniform vec2 u_size;
-uniform vec4 u_borderColor;
uniform vec4 u_fillColor;
noperspective in vec2 f_uv;
@@ -23,14 +22,15 @@ main()
{
const float border_width = 2.0;
- float t = step(border_width, f_uv[1]);
- float r = step(border_width, u_size.x - f_uv[0]);
- float b = step(border_width, u_size.y - f_uv[1]);
- float l = step(border_width, f_uv[0]);
- float fill_mix = t * r * b * l;
- float border_mix = 1.0 - fill_mix;
- vec4 fill = fill_mix * u_fillColor;
- vec4 border = border_mix * u_borderColor;
+ vec4 border_color = u_fillColor + vec4(0.0, 0.4, 0.4, 0.0);
+ float t = step(border_width, f_uv[1]);
+ float r = step(border_width, u_size.x - f_uv[0]);
+ float b = step(border_width, u_size.y - f_uv[1]);
+ float l = step(border_width, f_uv[0]);
+ float fill_mix = t * r * b * l;
+ float border_mix = 1.0 - fill_mix;
+ vec4 fill = fill_mix * u_fillColor;
+ vec4 border = border_mix * border_color;
FragColor = fill + border;
}