ncatdesigner Posted June 2, 2020 Share Posted June 2, 2020 Hi there! I'm migrating my engine from v4 to v5, but I am having problems using a graphics object as a texture. Any ideas? const graphics = new PIXI.Graphics(); graphics.lineStyle( backgroundStyle.strokeWidth, backgroundStyle.strokeColor, backgroundStyle.strokeOpacity ); graphics.beginFill(BACKGROUND_COLOR, BACKGROUND_OPACITY); graphics.drawRoundedRect( ZERO, ZERO, width, height, NODE_CORNER_RADIUS ); graphics.endFill(); const texture = graphics.generateCanvasTexture(); sprite.texture = texture; But now I don't know how to get the texture from graphics since I am trying not to use the legacy version for pixi. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 2, 2020 Share Posted June 2, 2020 (edited) this should work : "const texture = renderer.generateTexture(graphics);" However if you dont like antialising quality, you should use legacy, dont mind the name, canvas2d is still has no alternative in shapes quality. Its just several tens Kb of code Edited June 2, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.