glProgram1 = new CCGLProgram();
glProgram1->retain();
glProgram1->initWithVertexShaderFilename("test.vsh","test.fsh");
glProgram1->addAttribute(kCCAttributeNameTexCoord,kCCVertexAttrib_TexCoords);
//要设置一下三行属性,否则在安卓上画不出来
glProgram1->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_POSITION,GLProgram::VERTEX_ATTRIB_POSITION);
glProgram1->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_COLOR,GLProgram::VERTEX_ATTRIB_COLOR);
glProgram1->bindAttribLocation(GLProgram::ATTRIBUTE_NAME_TEX_COORD,GLProgram::VERTEX_ATTRIB_TEX_COORDS);
glProgram1->link();
glProgram1->updateUniforms();
原文链接:https://www.f2er.com/cocos2dx/345800.html