Jump to content



Recommended Posts

hi :)


I'm trying to take a screenshot of my canvas and adding it (as an image) to my game.


actually, I have in my game an image in the corner that keep chenging according to what I have in the canvas (like a picture of the canvas that update everytime something change in it)


I thought of checking everytime for a change, and if there is one to take a screenshot of canvas and adding it as an image.


I tried with  "game.canvas.toDataURL();" but all I got is a black image.




thanks :)

Link to comment
Share on other sites

You need to either render your canvas using a canvasrenderer instance or to preserve the drawing buffer for webgl.

However taking snaphots of a canvas whenever something is changing will drop your games performance and probably makes it unplayable for some people.


Why are you taking those snapshots? Maybe there is a more performant way to solve your 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...