Sign in to follow this  
drfrankius

Create Texture with RenderTexture as a base texture

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


 

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.