MotionStreak issues

MotionStreak issues
0.0 0



I have been testing MotionStreak motion but there appears to be a bug with opacity.

I tested another engine: wiEngine that i think is similar in functionality to cocos2d-x and it does not present this bug.

Is there a different way to create this sort of trail? I need it for a project. Thanks! :slight_smile:


Could you please paste a picture to describe the bug?



Thank you for your reply.

Yes I can: I have attached it. It appears to be a bug in the alpha channel. Let me know if you need the WiEngine image to compare.


On win32, we use opengl es lib offered by POWERVR, not use opengl directly.
How about on real phones?


I have not tested on real phone yet. I will do that and update you accordingly. thanks for your reply.


Found a bug. The streak image will disappears after pause and resume.


It is generated at runtime, and android will lose OpenGL context after pause.
So, you should save it.
You can refer RenderTextureTest.


Hi Minggo thanks for your feedback.

The only image that disapeers is the one that does the motion streak.

Press Home btn

All other images are ok. So my question is wend do I have to save context and for what objects?


The engine caches the paths of pictures and reload them if the OpenGL context is lost.
You can refer the codes in HelloWorld/android/jni/helloworld/main.cpp.

I don’t know why one image disappear. Is it loaded from a file?



I just wanted to test it so I basically copy pasted the code and simply added code. I am going to test the tests package on device to see if there is the same issue.

void MotionStreakTest1::onEnter()

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    // the root object just rotates around
    m_root = CCSprite::spriteWithFile(s_pPathR1);
    addChild(m_root, 1);
    m_root->setPosition( CCPointMake(s.width/2, s.height/2) );

    // the target object is offset from root, and the streak is moved to follow it
    m_target = CCSprite::spriteWithFile(s_pPathR1);
    m_target->setPosition( CCPointMake(100,0) );

    // create the streak object and add it to the scene
    m_streak = CCMotionStreak::streakWithFade(2, 3, s_streak, 32, 32, ccc4(0,255,0,255) );
    addChild( m_streak );
    // schedule an update on each frame so we can syncronize the streak with the target

    CCActionInterval* a1 = CCRotateBy::actionWithDuration(2, 360);

    CCAction* action1 = CCRepeatForever::actionWithAction(a1);
    CCActionInterval* motion = CCMoveBy::actionWithDuration(2, CCPointMake(100,0) );
    m_root->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)(CCSequence::actions(motion, motion->reverse(), NULL)) ) );
    m_root->runAction( action1 );


Here is the same issue from tests on Android device:

It seems that overlap reagions create saturated areas or white… is this to be expected, how to fight against this effect?


I have tested this test case on cocos2d-iphone, and it has the same effect.
You can try it by yourself.