Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17091

RenderTexture Save and Load file doesn't work on Android

$
0
0

@diepduong wrote:

Hi,

I am using RenderTexture to save and load image, it works well ọn iOS but not on Android.

Here is my sample code:

// Create render texture and capture image from spriteA
RenderTexture *render = RenderTexture::create(100,100);
render->begin();
spriteA->visit();
render->end();

//Save image file from Render Texture
render->saveToFile("SavedFileName", Image::Format::PNG)

//Load file into Sprite then
std::string fullpath = FileUtils::getInstance()->getWritablePath() + "SavedFileName";
Sprite *sprite = Sprite::create(fullpath);

The sprite with image the same as spriteA above but it's quite empty on Android.

Anybody help?

Thank you.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17091


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>