Is there any way to tint a sprite like this? (see image)

Is there any way to tint a sprite like this? (see image)
0.0 0


From this page:

(from 0 - 255)

I would use the blog post I linked, but it’s written for cocos2d-iphone, and it uses OpenGL ES 1.0, not 2.0.

Is there any way to do this?


Haven’t checked the blog but by just looking at the picture I think you could achieve the same effect by overlaying the image with a completely solid color sprite and adjust its alpha value.


Well, yeah, but I’m wondering if there was a way to do it with shaders or something, or would that just not be worth it. (It’s also easier to just tint the sprite, rather than making one for each sprite).


Can CCTintTo meet your requirement? If not, shaders can do it :slight_smile:


I don’t think CCTintTo can, as it just does subtractive blending (as far as I know).


How would I use a shader to make this effect?


Hi Sam!,
Currently, I’m trying to do the same, did you implement this?
Thank you.


This is a good tutorial about a Color Shader :
Generally the whole tutorial section about shaders is quite good and thouroughly explained. Unfortunatelly it is aimed at the PC version of OpenGL and I don’t know how well it will transalte into OpenGL ES.