Jump to content

rendering bitmapData


L2L2L
 Share

Recommended Posts

I'm trying to render a bitmap data multiple times. the code is very simple. I just do what I have to with the ctx property of the bitmap, this works when I just game.add[sprite|image](0,0,bitmapData); but is slow.

 

I try to use sprite.setTexture(bitmapData); or image.setTexture(bitmapData); but does not work.

Link to comment
Share on other sites

This is the recommended way to use a single bitmapData across many sprites: http://examples.phaser.io/_site/view_full.html?d=bitmapdata&f=cached+bitmapdata.js&t=cached%20bitmapdata

 

You could use loadTexture too, but it should only be done once, when the sprite is created. After that you just update the bitmapData itself and flag it as dirty.

Link to comment
Share on other sites

thanks for responding, and the help. It work,,, but the dynamic created graphic that I will use from bitmapData is not rendering right. This graphic is a imageData that is create through canvas 2d render's methods. Do you have any suggestion for that.

 

What I'm doing:

 

1. Creating dynamic graphic with the bitmapData using it's property context.

2. take the image data off that canvas and altering the pixels

3. rendering the result to canvas through sprite aka display object.

 

the result is blur... if that help.

 

Thanks again for the help.

Link to comment
Share on other sites

I only partly follow what you mean... are you using 1 bitmapData for the blur effect, and then another for the Sprite textures? Or just 1 bitmapData with the whole blur effect on it for all sprites?

 

Showing some simplified / cut-down code would help

Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...
 Share

  • Recently Browsing   0 members

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