Skip to content

Instantly share code, notes, and snippets.

@1901
Created May 15, 2014 01:47
Show Gist options
  • Save 1901/dafc21f709cc43ac6479 to your computer and use it in GitHub Desktop.
Save 1901/dafc21f709cc43ac6479 to your computer and use it in GitHub Desktop.
Cocos2d中设置Sprite的Shader
CCGLProgram* p = new CCGLProgram();
p->initWithVertexShaderFilename("shader/BanishShader.vsh", "shader/BanishShader.fsh");
p->addAttribute(kCCAttributeNamePosition, kCCVertexAttrib_Position);
p->addAttribute(kCCAttributeNameColor, kCCVertexAttrib_Color);
p->addAttribute(kCCAttributeNameTexCoord, kCCVertexAttrib_TexCoords);
p->link();
p->updateUniforms();
pSprite->setShaderProgram(p);
p->release();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment