[cairo] [RFC] Cairo GLES2 and GL_CLAMP_TO_BORDER

Jonathan Morton jonathan.morton at movial.com
Fri Feb 18 08:26:37 PST 2011


On Fri, 2011-02-18 at 18:13 +0200, Alexandros Frantzis wrote:
> create W+1 x H+1 textures

You need four borders, so: s/+1/+2/g.

Another alternative would be to compute the edge fade-to-transparent in
the shader, using CLAMP_TO_EDGE on the texture itself.  The only extra
information required by the shader for this would be the texture pixel
dimensions, which would be required anyway if the texture is "manually"
filtered.  I think these could be passed in uniforms.

As a first pass:

sampler2D tex;
uniform vec2 dims;
varying vec2 coords;
vec2 fades = clamp(dims * (1.0 - abs(coords - 0.5)), 0.0, 1.0);
vec4 colour = texture(tex, coords) * fades.x * fades.y;
...

-- 
------
From: Jonathan Morton
      jonathan.morton at movial.com




More information about the cairo mailing list