Jump to content

Converting graphics to sprites results in an unexpected texture?


Recommended Posts

Hi, I am currently trying to convert pixi graphics to sprites for performance improvements.

I have the following code.

const graphic = new PIXI.Graphics();
  .beginFill(0xFFFFFF, 0.5)
  .lineStyle(1, 0x000000, 1)
  .drawCircle(0, 0, 10)
graphicTexture = app.renderer.generateTexture(graphic);


This works with 

const sprite = new PIXI.Sprite(graphicTexture);

and it actually improves the performance significantly.
However, it is showing unnecessary white background like below.


It is supposed to be a blue circle with the black background but it seems to be writing a blue circle on a white rectangle.

Could someone tell me what I might be doing wrong here?

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

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.


  • Recently Browsing   0 members

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