0

我正在玩 cocos2d-iphone,它看起来很棒!

但是我想为每次更新在屏幕上绘制另一个圆圈,这会非常快地降低帧速率!我可以以更快的方式绘制多个图元吗?

这是我目前使用的代码

-(void) draw
{
    glLineWidth(1);
    glColor4ub(100,100,255,0);
    float angle = 0;
    float radius = 10.0f;
    int numSegments = 10;
    bool drawLineToCenter = NO;

    NSInteger point;
    for (point=0;point < [points count];point++)
    {
        ccDrawCircle([[points objectAtIndex:point] CGPointValue], radius, angle, numSegments, drawLineToCenter);

    }
}
4

1 回答 1

1

使用精灵而不是图元。然后你可以使用 CCSpriteBatchNode。

cocos2d 的原始绘制方法主要是为了调试目的,而不是为了弥补你的游戏艺术。主要它们不是批处理操作,这意味着您绘制的每个新图元都会发出一次绘制调用。这很昂贵。

于 2012-05-02T20:09:35.463 回答