为什么我用了CCSpriteBatchNode也没降低帧数

同样是5000个sprite,加了CCSpriteBatchNode和没加效果是一样的。为什么?

CCSpriteBatchNode* batchNode = CCSpriteBatchNode::create(“runner.png”);
batchNode->setPosition(CCPointZero);

for(int i = 0;i < 5000;++i){
float x = CCRANDOM_0_1()*1280;
float y = CCRANDOM_0_1()720;
CCSprite
testIcon = CCSprite::createWithTexture(batchNode->getTexture());
testIcon->setPosition( ccp(x, y) );
batchNode->addChild(testIcon);

}

this->addChild(batchNode);

for(int i = 0;i < 5000;++i){
float x = CCRANDOM_0_1()*1280;
float y = CCRANDOM_0_1()720;
CCSprite
testIcon = CCSprite::create(“runner.png”);
testIcon->setPosition( ccp(x, y) );
this->addChild(testIcon);

}

  1. CCSpriteBatchNode在创建的时候最好指明capacity
  2. 尽量让精灵显示在可视区域(随机坐标限制下)
    其它…(我也不知道)

LZ,你的第一张图不就是1么- -为什么说没效果

不要用pc模拟窗口来验证帧数。请用手机测试,怎么可能会没区别。真机和电脑,测试出来的东西完全不能划等号

第三行的帧数一样

确实是这样,3q

三楼正解。
— Begin quote from ____

引用第3楼conjure83226于2013-12-30 11:15发表的 :
不要用pc模拟窗口来验证帧数。请用手机测试,怎么可能会没区别。真机和电脑,测试出来的东西完全不能划等号 http://www.cocoachina.com/bbs/job.php?action=topost&tid=176709&pid=865813

— End quote

其实是这样的, spritebatchnode是动态batch,每帧都需要去用cpu整理所有定点到一个array,再一次性传给显卡
显卡的工作量减少了,但是cpu负荷高了

这个就要你自己判断了,看看你的游戏是cpu不够用,还是gpu不够用