[gtk+/wip/baedert/gl: 86/86] gl renderer: Only take glyph texture alpha into account



commit e5892bc0a11b53a6357419693bfee052f2fadb84
Author: Timm Bäder <mail baedert org>
Date:   Sat Dec 9 18:31:28 2017 +0100

    gl renderer: Only take glyph texture alpha into account
    
    This way, we can use the very same coloring program to draw text shadows
    of fonts with colored glyphs.

 gsk/resources/glsl/coloring.fs.glsl |    5 +++--
 gsk/resources/glsl/shadow.fs.glsl   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gsk/resources/glsl/coloring.fs.glsl b/gsk/resources/glsl/coloring.fs.glsl
index 120c13c..9faab8c 100644
--- a/gsk/resources/glsl/coloring.fs.glsl
+++ b/gsk/resources/glsl/coloring.fs.glsl
@@ -1,4 +1,3 @@
-
 uniform vec4 u_color;
 
 void main() {
@@ -8,5 +7,7 @@ void main() {
   // pre-multiply
   color.rgb *= color.a;
 
-  setOutputColor((diffuse * color) * u_alpha);
+  color = vec4(u_color.rgb * diffuse.a * u_alpha, diffuse.a * color.a * u_alpha);
+
+  setOutputColor(color);
 }
diff --git a/gsk/resources/glsl/shadow.fs.glsl b/gsk/resources/glsl/shadow.fs.glsl
index f3535f1..9faab8c 100644
--- a/gsk/resources/glsl/shadow.fs.glsl
+++ b/gsk/resources/glsl/shadow.fs.glsl
@@ -7,7 +7,7 @@ void main() {
   // pre-multiply
   color.rgb *= color.a;
 
-  color = vec4(u_color.rgb * diffuse.a, diffuse.a * color.a);
+  color = vec4(u_color.rgb * diffuse.a * u_alpha, diffuse.a * color.a * u_alpha);
 
   setOutputColor(color);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]