Bringing assets to a new canvas?

I need to render an image off screen for sharing on social networks. Currently Cocos Creator doesn’t allow for rendering a single node off screen so I opted for server side rendering instead. Unfortunately our servers can’t keep up with the amount of requests so I’m looking at an alternative to throwing more hardware at the problem.

So, since I can’t render a single node I thought that maybe somehow I can copy assets to another canvas and take a screenshot of that instead. But I don’t know how I would create a new canvas and add Cocos Creator nodes to it.

It would have to include some sprites and textfields with dynamic text with pixel fonts. Has anyone attempted such a thing yet?

Thanks for reading.

I was thinking about doing exactly the same thing. Did you find a solution to this after all?

I did manage to get a an image out of it. The image size and the placement of the node within it would change depending on it’s position on the canvas and it’s scale, amongst other things, which I couldn’t work out in time before having to abandon the idea.

I figured out a a way of doing it but my needs are probably simpler than yours.

Instead of “taking a screenshot” of the gameCanvas, I just used canvas.drawImage to draw the textures I need to a temp canvas and grabbed the base64 data from there. Come to think of it, this solution has almost nothing to do with the Cocos API.

My game only needs to run on browsers so that worked out for me.