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

 Share

  • Recently Browsing   0 members

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