Jump to content

Take a screenshot of the canvas


Recommended Posts

  • 3 months later...

Hi guys, finally the use of game.canvas.toDataUrl() works for me.

I'm using OOP on my games now, which I didn't do before. I don't know if it's from this or because the new phaser version (I was on 1.1.3, now 2.0.4), but it works perfectly with toDataUrl.

Be careful though, I like to develop my game for web browser, but also for Cocoonjs, and I don't think they support the toDataUrl as it's not in their HTML5 list of supported canvas function.

Link to comment
Share on other sites

  • 1 year later...

I learned now. We saw black picture. Because our games use WebGL as renderer. Canvas renderer is working perfectly.


Worth noting — now to support .png screenshots of WebGL rendered games, you can set a config parameter preserveDrawingBuffer that will let you call game.canvas.toDataURL() with WebGL or Canvas renderers with no issue.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...