Recently we changed the behaviour of the font rendering as some of you may have witnessed. We initially had a few hickups with GL errors and stuff but it seems to work pretty stable since the 1.2.140 release this week. Someone on the forum (@Pkeod I think) asked about font gradients so I thought that I could share a little tiny demo of how to achieve that effect.
To get a local [0…1] gradient in your font shader, you can do something like this:
lowp vec4 cache_sample = texture2D(texture, var_texcoord0.xy); lowp float gradient_value_y = fract(var_texcoord0.y / texture_size_recip.w); lowp vec3 color_a = vec3(1.0,0.0,1.0); lowp vec3 color_b = vec3(0.0,1.0,1.0); lowp vec3 color_gradient = mix(color_a,color_b,gradient_value_y); gl_FragColor = vec4(color_gradient,1.0) * cache_sample.x;