Jump to content

Does anyone know how to copy a pixi.js texture, or copy it to canvas?


agamemnus
 Share

Recommended Posts

I have a jigsaw game where I need to modify piece images when they are joined or when they are added to the central area. At the moment I am destroying the texture and re-adding the canvas every time the canvas changes.

 

I guess I am a bit lost on how exactly the texture stuff works... for example, I see a <canvas> element in the object structure after I create a texture, but getting its context and then modifying it does nothing unless I "destroy" the texture object and re-make it.

I don't know what the most efficient way of doing this is.

 

I could possibly use the PIXI primitives to do everything (the pieces have a border and soft bevel which I make with <canvas> functions) but I haven't gotten to that yet...

Link to comment
Share on other sites

Hi! In this thread you can read more about the render texture method and how to use it.

 

http://www.html5gamedevs.com/topic/6507-display-object-container-to-an-imagesprite/#entry38726

 

Additional info about renderTexture cropping with newer versions of pixi.js (1.6.0 used)

 

http://www.html5gamedevs.com/topic/8613-upgrading-to-pixi-160/#entry51302 

 

 

But then again if they have interlapping elements why would you like to render parts of them into the canvas gain and not just leave them together connected with sort of snap to the edge method and not allow them to be disconnected?

 

http://www.sevenative.com

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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