Jump to content

BitmapData vs RenderTexture


richpixel
 Share

Recommended Posts

Not sure if this topic has been covered somewhere, but I'm trying to decide whether to use a BitmapData or a RenderTexture...

 

I want to create some background scenery by drawing a bunch of different plants and trees which are sprites, and then hopefully create a static texture that would render a lot faster than rendering all the sprites separately.

 

Ideally I could dynamically create a single Phaser.Image and add that to the world... there are some examples doing this with a BitmapData, but I'm not sure what the pros/cons of using RenderTexture instead might be.

 

Also wondering about max width/height in such a scenario...

 

Thanks a lot!

 

 

Link to comment
Share on other sites

Also!

 

What is the best way to "hopefully create a static texture".  He can use a BitmapData, draw to it, and then create a new Phaser.Image using that BitmapData instead of a texture.  This works.  But it means if you have 20 say, icons, you have 20 BitmapData. 

Since a BitmapData wraps a HTMLCanvasElement, we could use toDataURI() to get out an encoded string.  But then you kind of have some weird encoded string base64..... How does that fit into phaser? Sounds slow to me. 

+Everything rich asked.

 

 

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