Jump to content

BitmapData.generateTexture Firefox


Mirv
 Share

Recommended Posts

I've been playing around with BimapData, generating composite images on the fly because I'm too lazy to combine them in an image editor program :)

I noticed that the sprite drawn from the image cache key appeared in chrome, but not firefox.

I reproduced  this on the Phaser Sandbox - Single Sprite Template in chrome and firefox by setting the create code to the following:

function create() {
    var sprite = game.add.sprite(0, 0, 'phaser');

    var testBmd = game.make.bitmapData(27, 40);
    testBmd.copy('phaser');
    testBmd.generateTexture('phaserTexture');

    game.add.sprite(60, 60, 'phaserTexture')
}

 

The second phaser sprite appeared in chrome but not firefox.

Any input is appreciated, thanks!

 

 

Link to comment
Share on other sites

  • 2 months later...

Here is a workaround:

function preload() {
    var bmd = game.make.bitmapData(0, 0);
    // draw on bmd …
    
    this.load.image('bmdImage', bmd.canvas.toDataURL());
    
    bmd.destroy();
}

function create() {
    // If you need to make a spritesheet:
    this.cache.addSpriteSheet('bmdSpritesheet', null,
        this.cache.getImage('bmdImage'),
        frameWidth, frameHeight, frameMax, margin, spacing);

    this.add.sprite(0, 0, 'bmdImage');
    this.add.sprite(0, 0, 'bmdSpritesheet');
}

 

Link to comment
Share on other sites

  • 3 months later...

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