Jump to content

Converting graphics to sprites results in an unexpected texture?


rks
 Share

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();
graphic
  .beginFill(0xFFFFFF, 0.5)
  .lineStyle(1, 0x000000, 1)
  .drawCircle(0, 0, 10)
  .endFill();
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.

image.png.8bef8c807773a121edf0fa55cf90dc46.png

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.

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