Apple's oplengl GLImageProcessing loads an image and applies image adjustments: brightness, saturation, contrast, hue and sharpness.
How can GLImageProcessing be used on a CCSprite?
Any help would be appreciated!
Update:
Cocos2d v2 has shader support. For Image Effects look up GLSL shader called Photoshop Math.
I've applied approach from GLImageProcessing to change the hue of CCSpite and wrote a subclass of CCSprite for convenient usage. Check this out: https://github.com/alex314/CCSpriteWithHue
Cocos2D is an Objective-C framework wrapping openGL plain C API.
GLImageProcessing Sample code is an example of using openGL.
To apply similar effects to a CCSprite
, AFAIK, there is not hue, brightness or such image processing effects into Cocos2D. So I would suggest to override CCSprite and code your own drawing, inspiring from GLImageProcessing.
The interesting entry points are, for CCSprite
:
-(void) draw
Which is responsible of openGL drawing of you sprite.
For GLImageProcessing
:
void drawGL(int wide, int high, float val, int mode)
There are several discussions to implement like GLImageProcessing with cocos2d. You can call any GL API in cocos2d.
- texture modulation
- Using a texture combiner to render CCSprite in greyscale?
- Gaussian BLUR implemented in cocos2d!