Jump to content

Create Texture with RenderTexture as a base texture


drfrankius
 Share

Recommended Posts

I am trying to create multiple PIXI.Texture instances using a Phaser.RenderTexture as the base. This does not seem to work though. When I set the texture on a sprite it just appears blank. Doing the same with a baseTexture from the cache seems to work.

const texture = new PIXI.Texture(renderTextureInstance, new PIXI.Rectangle(0, 0, 200, 200), new PIXI.Rectangle(0, 0, 200, 200)); // DOES NOT WORK

const texture = new PIXI.Texture(game.cache.getBaseTexture('buttons'), new PIXI.Rectangle(0, 0, 200, 200), new PIXI.Rectangle(0, 0, 200, 200)) // WORKS

I also tried using the renderTextureInstance.baseTexture reference and neither seem to work. When I create a sprite using the renderTexture it works just fine.

Is this Some limitation of RenderTextures in the Phaser 2/CE code? Is there a workaround?

thanks


 

 
Link to comment
Share on other sites

Well, found something that works now. Just thought I would post an update for anyone stumbling over similar issues.

When creating a Phaser.Sprite instance with a RenderTexture instance as its texture the only way i could get it to respect the frameData was to call .setFrame() on the sprite and pass in the Phaser.Frame instance manually. The framing rects passed in to the texture instances seem to be ignored.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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