Custom TextureTintPipeline

Hi, I have a couple of questions regarding custom shaders.

I would like to extend TextureTintPipeline and add a custom fragment shader that draws outline of a sprite. Below is the shader:

var outline = precision mediump float; uniform sampler2D uMainSampler; uniform vec2 uUnit; varying vec2 outTexCoord; varying float outTintEffect; varying vec4 outTint; void main() { vec4 color = texture2D(uMainSampler, outTexCoord); if (color.a<0.01) { float a = 0.0; for(int size=1; size<=5; ++size) { float s = float(size); float r = texture2D(uMainSampler, outTexCoord+vec2(uUnit.x*s, 0)).a, t = texture2D(uMainSampler, outTexCoord+vec2(0, -uUnit.y*s)).a, l = texture2D(uMainSampler, outTexCoord+vec2(-uUnit.x*s, 0)).a, b = texture2D(uMainSampler, outTexCoord+vec2(0, uUnit.y*s)).a; a = a + r*0.01 + t*0.01 + l*0.01 + b*0.01; } if (a>0.0) color = vec4(1, 1, 1, a); } gl_FragColor = color; };

It draws the outline, however alpha value is completely ignored. It is always either 0 or 1 (even if i manually set it to color = vec4(1,1,1,0.1), it shows up as opaque white. What am i missing?

Secondly, I would like to add some attributes, and supply data to them on batchQuad. I see “addAttribute” function, but vertexComponentCount is computed in the constructor, so calling addAttribute after super(config) results in wrong component count. Also batchQuad puts data to pre-defined buffer offsets. Currently I am hacking it by adding this.vertexComponentCount += <# of new attributes count> manually after super(config), and copying and pasting entire batchQuad function, and rewriting it. Is there any more elegant way of overriding it?

Thanks!

gabe

this should help.