zlobul Posted May 10, 2021 Share Posted May 10, 2021 (edited) I don't understand why this is not working ? https://www.pixiplayground.com/#/edit/zI1a807CKp1QueSLypGGO If I add the "line" object to the stage , it will appear . Building a texture and then creating a sprite from it is not working , why ? Thanks Edited May 10, 2021 by zlobul Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 10, 2021 Share Posted May 10, 2021 looks like a bug. should be reported in pixijs github issues. zlobul 1 Quote Link to comment Share on other sites More sharing options...
zlobul Posted May 10, 2021 Author Share Posted May 10, 2021 Thanks , I have submitted a new issue : https://github.com/pixijs/pixi.js/issues/7481 Quote Link to comment Share on other sites More sharing options...
zlobul Posted May 11, 2021 Author Share Posted May 11, 2021 Its not a bug. I'm pasting the answer here as well : This is working as intended. The issue here is this line: line.position.set(200,100) and your element being detached (not added to any tree). The API generateTexture uses getLocalBounds for determining the region to render. If you are using a detached element like in your cases, you have a few options: Remove setting the position // line.position.set(200,100) let texture = app.renderer.generateTexture(line) Add the line, then remove it app.stage.addChild(line); let texture = app.renderer.generateTexture(line); app.stage.removeChild(line); Manually provide the region let texture = app.renderer.generateTexture(line, undefined, undefined, line.getBounds()); MrPancakes 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 11, 2021 Share Posted May 11, 2021 Nope, its still a bug of "generateTexture" . original position shouldnt affect the result. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 11, 2021 Share Posted May 11, 2021 Oh, its a problem only if "line" is detached. Here i added it before "generateTexture" and it works: https://www.pixiplayground.com/#/edit/bfuM3jVj7KGPyYIYlfKNz zlobul 1 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.