CCSprite* HelloWorld::spriteWithColor(ccColor4F bgColor,float textureSize){
    //创建一个新的ccRenderTexture
    CCRenderTexture * rt = CCRenderTexture::create(textureSize,textureSize);
    //调用begin方法ccRendertexture:begin
    rt->beginWithClear(bgColor.r,bgColor.g,bgColor.b,bgColor.a);
    //绘制纹理     
    glDisable(GL_TEXTURE_2D);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
          float gradientAlpha = 0.7f;
    CCPoint vertices[4];
    ccColor4F colors[4];
    int nVertices =0;
    vertices[nVertices] = CCPointMake(0,0);
    colors[nVertices++] = ccc4f(0,0,0,0);
    vertices[nVertices] = CCPointMake(textureSize,0);
    colors[nVertices++] = ccc4f(0,0,0,0);
    vertices[nVertices] = CCPointMake(0,textureSize);
    colors[nVertices++] =ccc4f(0,0,0,gradientAlpha);
    vertices[nVertices] = CCPointMake(textureSize,textureSize);
    colors[nVertices++] = ccc4f(0,0,0,gradientAlpha);
    glVertexPointer(2,GL_FLOAT,0,vertices);
    glColorPointer(4,GL_FLOAT,0,colors);
    glDrawArrays(GL_TRIANGLE_STRIP,0,(GLsizei)nVertices);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnable(GL_TEXTURE_2D);

    CCSprite* noise = CCSprite::create("Noise.png");
    ccBlendFunc bF = {GL_DST_COLOR,GL_ZERO};
    noise->setBlendFunc(bF);
    noise->setPosition(ccp(textureSize/2,textureSize/2));
    noise->visit();
    //调用 ccRendertexture:end
    rt->end();
    return CCSprite::createWithTexture(rt->getSprite()->getTexture());
}就是想实现给纹理增加一个梯度的效果,从上到下逐渐变暗,是跟着cocos2d的CCRenderTexture动态纹理的教程做的,现在卡这了,怎么也调不出来,单点调试的时候停到红色字体那行代码可行,再点下一步就报错了,报错之后显示的在下图.
crash