custom shader

Hello,
I have a really fast blur shader which requires two passes (horizontal and vertical).
I need to apply this to a render texture.The difference between the two passes is made through 2 uniform variables.Is there any way to achieve this with cocos2d x v3 or I need a simple but not that fast blur shader?
Thank you.


Screen Shot 2014-04-04 at 22.57.41.png (38.1 KB)

I’ve managed to use the shader using two render textures but the output is not good.

rtt->begin();
this->visit();
rtt->end();
blur_sprite=new SpriteBlur();
blur_sprite->initWithTexture(rtt->getSprite()->getTexture(), rtt->getSprite()->getTextureRect());
blur_sprite->setPosition(width/2,height/2);
//blur_sprite->setFlippedY(true);

this->addChild(blur_sprite);


rtt2->begin();
this->addChild(blur_sprite);
this->visit();
rtt2->end();

blur_sprite->initWithTexture(rtt2->getSprite()->getTexture(), rtt2->getSprite()->getTextureRect());
//blur_sprite->setFlippedY(true);

rtt->begin();
blur_sprite->draw(Director::getInstance()->getRenderer(), getNodeToParentTransform(), false);
this->removeChild(blur_sprite);
rtt->end();


auto sprite=Sprite::createWithTexture(rtt->getSprite()->getTexture());
sprite->setPosition(width/2,height/2);
sprite->setFlippedY(true);
this->addChild(sprite);

I’ve made that blur_sprite needs exactly two consecutive draw draw calls to make first horizontal then vertical blur.
I’m not sure home many draw calls happen when i add blur_sprite to the main layer.
I would need to explicit draw the sprite but by calling draw but it s not working.
How can i achieve this?