Related Discussions
...

hi :
i wanna stroke my animation in my game like this:

Image removed due to the lack of support for HTTPS. | Show Anyway

,(the yellow outer stroke).
Can you give me some suggestions. my runtime is cocos2dx.
Thank you !

I'd love to be able to do this too!

I assume a shader like this is written in Cg.

Pretty similar to the outline drawn around images or when you use Ghosting in Spine. That is handled by a shader.

5 days later

Yeah, thank you !
Shader is worked,but I meet another problem: every slot(attachment pic) drawn outline :doh: ,this is not what I want.,I just hope the whole body draw outline.
my shader code:

#ifdef GL_ES
precision lowp float;
#endif

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform sampler2D CC_Texture0;

void main()
{
    float radius = 0.005;
    float threshold = 1.75;
    vec4 accum = vec4(0.0);
    vec4 normal = vec4(0.0);
    normal = texture2D(CC_Texture0, v_texCoord);
    accum += texture2D(CC_Texture0, vec2(v_texCoord.x - radius, v_texCoord.y - radius));
    accum += texture2D(CC_Texture0, vec2(v_texCoord.x + radius, v_texCoord.y - radius));
    accum += texture2D(CC_Texture0, vec2(v_texCoord.x + radius, v_texCoord.y + radius));
    accum += texture2D(CC_Texture0, vec2(v_texCoord.x - radius, v_texCoord.y + radius));

accum *= threshold;
accum.r = 1.0;
accum.g = 0.0;
accum.b = 0.0;

//    normal = (accum * (1.0 - normal.a)) + (normal * normal.a);
    if (normal.a <= 0.05)
    {
        normal = (accum * normal.a) + (normal * normal.a);
    }
    else
    {
        normal = (accum * (1.0 - normal.a)) + (normal * normal.a);
    }

gl_FragColor = v_fragmentColor*normal;

}

I believe you need to render the entire thing to the FBO (frame buffer object) and then apply the shader on that instead, I'm really no programmer but maybe it will point you in the right direction.

I didn't even know what an FBO was until a few days ago. salutes shiu