Question

I use Kobold2D and I just upgraded from version 2.0.3 to version 2.1.0 (this means that I've gone from cocos2d-iphone v2.0 to cocos2d-iphone v2.1).

Before the upgrade my project was running and looking great on my iPhone 5.

After the upgrade these mysterious, flickering, shimmering, angular artifacts have appeared when I run the project on the iPhone. They are quite widespread, but interestingly, when I run the project in the simulator, no such artifacts occur.

There seems to be a correlation to the artifacts and my use of cocos CCParticleSystem animation objects. In other words, the artifacts seem to be present for the duration of the particle animations, and seem to disappear after the "lifespan" of the particle animations is complete.

Here's a screenshot. In this case, the artifacts appear as the blue "wedges", but they shift around a lot and sometimes take on other colours and shapes.

Does anybody know what I can do to eliminate these annoying artifacts?

Screenshot

Was it helpful?

Solution

Is a known bug: http://www.cocos2d-iphone.org/forum/topic/208630?replies=6#post-376569

to fix (or to patch :), modify CCParticleSystemQuad.m. In postSetp method comment Option 1 and uncomment Option 3.

This worked for me and for DropDKeith (user forum cocos2d)

-(void) postStep
{
    glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0] );

    // Option 1: Sub Data
//  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0])*_particleCount, _quads);

    // Option 2: Data
//  glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _particleCount, _quads, GL_DYNAMIC_DRAW);

    // Option 3: Orphaning + glMapBuffer
    glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0])*_totalParticles, nil, GL_STREAM_DRAW);
    void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
    memcpy(buf, _quads, sizeof(_quads[0])*_particleCount);
    glUnmapBuffer(GL_ARRAY_BUFFER);

    glBindBuffer(GL_ARRAY_BUFFER, 0);

    CHECK_GL_ERROR_DEBUG();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top