L2L2L Posted January 8, 2015 Share Posted January 8, 2015 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 More sharing options...
L2L2L Posted January 8, 2015 Author Share Posted January 8, 2015 I use img.loadTexture(bitmapData); to render the bitmapData; which is dynamic for it change with each iteration. But the out come is still slow... very slow. So this post is still up for assistance. Link to comment Share on other sites More sharing options...
rich Posted January 8, 2015 Share Posted January 8, 2015 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 More sharing options...
L2L2L Posted January 9, 2015 Author Share Posted January 9, 2015 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 pixels3. 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 More sharing options...
rich Posted January 9, 2015 Share Posted January 9, 2015 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 More sharing options...
jdnichollsc Posted July 6, 2015 Share Posted July 6, 2015 Is possible to get many sprites with different textures using only one bitmapdata instance? Regards, Nicholls Link to comment Share on other sites More sharing options...
_o0o_ Posted July 6, 2015 Share Posted July 6, 2015 I think the fastest way I have found so far is :myBitMapDataObject.add(mySprite); Link to comment Share on other sites More sharing options...
caymanbruce Posted March 11, 2017 Share Posted March 11, 2017 On 7/6/2015 at 8:21 PM, _o0o_ said: I think the fastest way I have found so far is : myBitMapDataObject.add(mySprite); What does this code mean? Link to comment Share on other sites More sharing options...
Recommended Posts