I am trying to use strokes moved with Render Texture. This is my code:
void GameplayLayer::visitSpriteContinuously()
{
CCRenderTexture* canvas = CCRenderTexture::create(screenSize.width,screenSize.height,kCCTexture2DPixelFormat_RGBA4444);
canvas->setPosition(ccp(screenSize.width/2,screenSize.height/2));
this->addChild(canvas);
GameSprite* drawSprite=GameSprite::gameSpriteWithFile("circle.png");
this->addChild(drawSprite);
CCPoint start = starttouchPosition->getLocationInView();
start = CCDirector::sharedDirector()->convertToGL(start);
CCPoint end = starttouchPosition -> getPreviousLocationInView();
end = CCDirector::sharedDirector()->convertToGL(end);
float distance = ccpDistance(start, end);
canvas->begin();
for (int i = distance; i > 0; i--)
{
float difx = end.x - start.x;
float dify = end.y - start.y;
float delta = (float)i / distance;
drawSprite->setPosition(ccp(start.x + (difx * delta), start.y + (dify * delta)));
drawSprite->visit();
}
canvas->end();
}
I get the desired result on almost all Android devices that I tested, except for Samsung Tab 4. On the 4 tab, the sprite drawn is in the dotted image, even if the used base png image is solid. I searched a lot, but I did not find anything useful. If someone has seen similar problems and has a solution, please let me know. Below are the screenshots:
"A" displayed on other devices:

"A" displayed on the Samsung 4 tab:

source
share