开发者

Cocos2D: increasing Sprite Brightness

Is there a good way to adjust the brightness of a CCSprite without using an overlay sprite or creating a separate texture? The color property doesn't work since it can only decrease the brightness.

I am thinking this is possible by overriding the draw method and adding some opengl calls similar to what is found in http://developer.apple.com/library/ios/#samplecode/GLImageProcessing/Introduction/Intro.html , but all of my attempts have failed and I am very novice at writing raw opengl. Does anyone know if this is possible and what calls need开发者_Python百科 to be made?


Although it is not the same as brightness, it would be more bright.

[sprite setBlendFunc:(ccBlendFunc){GL_SRC_ALPHA, GL_ONE}];


I usually use [sprite setOpacity: 127] to dim it.


You could try "lightening" the sprite by using

char moreBright = 24;
[sprite runAction:[CCTintBy actionWithDuration:0.0f red:moreBright green:moreBright blue:moreBright]];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜