Material on 2d sprite do not work

// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}

auto rootNode = CSLoader::createNode("MainScene.csb");

addChild(rootNode);

auto properties = Properties::createNonRefCounted("Materials/2d_effects.material#sample");

// Print the properties of every namespace within this one.
//printProperties(properties, 0);

Material *mat1 = Material::createWithProperties(properties);

auto spriteBlur = Sprite::create("back_normal.png");
spriteBlur->setNormalizedPosition(Vec2(0.2f, 0.5f));
this->addChild(spriteBlur);
spriteBlur->setGLProgramState(mat1->getTechniqueByName("blur")->getPassByIndex(0)->getGLProgramState());

auto spriteOutline = Sprite::create("back_normal.png");
spriteOutline->setNormalizedPosition(Vec2(0.4f, 0.5f));
this->addChild(spriteOutline);
spriteOutline->setGLProgramState(mat1->getTechniqueByName("outline")->getPassByIndex(0)->getGLProgramState());

auto spriteNoise = Sprite::create("back_normal.png");
spriteNoise->setNormalizedPosition(Vec2(0.6f, 0.5f));
this->addChild(spriteNoise);
spriteNoise->setGLProgramState(mat1->getTechniqueByName("noise")->getPassByIndex(0)->getGLProgramState());

auto spriteEdgeDetect = Sprite::create("back_normal.png");
spriteEdgeDetect->setNormalizedPosition(Vec2(0.8f, 0.5f));
this->addChild(spriteEdgeDetect);
spriteEdgeDetect->setGLProgramState(mat1->getTechniqueByName("edge_detect")->getPassByIndex(0)->getGLProgramState());

return true;

}

not any effect…

Material was designed for 3D, but see what @ricardo says here about “abusing” it for 2D: Material system for 2D

thanks~~ i have sloved ,but run on android cost cpu:)

@rickystone could you share your solution? :smiley:

just put shader folder into u proeject, then it works