-Hello you guys.
Big thanks to cocos2dx and the community.
-I have a problem with render texture in cocos2d-x v3.0 rc0.
On my Iphone 4s run ios 7.1 .When i take a snapshot of the game and save the image by render texture it return just a black image all the time.
But everything go OK on Iphone(ios 7.1) simulator.
Please help me. I really need this function.
Thanks
Thank you!
The internal logic of renderTexture has been changed, could you please send us a small test case to reproduce the bug?
Then we can locate the problem more quickly.
I just using the Test code (RenderTexture Test) in cocos2dx Test suits.
And here the code of the saveImage method:
void RenderTextureSave::saveImage(cocos2d::Ref *sender)
{
static int counter = 0;
char png[20];
sprintf(png, "image-%d.png", counter);
char jpg[20];
sprintf(jpg, "image-%d.jpg", counter);
_target->saveToFile(png, Image::Format::PNG);
_target->saveToFile(jpg, Image::Format::JPG);
std::string fileName = FileUtils::getInstance()->getWritablePath() + jpg;
auto action1 = DelayTime::create(1);
auto func = [&,fileName]()
{
auto sprite = Sprite::create(fileName);
addChild(sprite);
sprite->setScale(0.3f);
sprite->setPosition(Point(40, 40));
sprite->setRotation(counter * 3);
};
runAction(Sequence::create(action1, CallFunc::create(func), NULL));
CCLOG("Image saved %s and %s", png, jpg);
counter++;
}
- Works fine on the simulator(ios 7.1)
- But returns a black image on the Iphone 4s ( ios 7.1)
This is odd. Is this a bug of cocos2dx v3.0 rc0.
Thanks
Sorry you guys.
My bad. I forgot to clean the cache of the code and the phone used it.
Now when i clean It works fine.
Thank again for your help.