mtorregrosa Posted June 11, 2019 Share Posted June 11, 2019 Using pixi.js v5, I'm trying to fill a polygon with about one hundred vertices using Graphics.drawPolygon(), but the polygon is drawn incorrectly. When I reduce the number of vertices to about 50, then the polygon is drawn correctly. Is there any limit (near 100) to the number of vertices that Graphics.drawPolygon() can draw? Thanks. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 11, 2019 Share Posted June 11, 2019 There's switch between batch rendering and one drawcall in PixiJS v5 graphics. It depends on number of vertices. Please make a demo and we'll fix it. For now you can enable batch on everything if you do https://github.com/pixijs/pixi.js/blob/dev/packages/graphics/src/GraphicsGeometry.js#L573 https://github.com/pixijs/pixi.js/blob/dev/packages/graphics/src/Graphics.js#L818 Workaround: "PIXI.GraphicsGeometry.BATCHABLE_SIZE = 101" . If you want even bigger polygons, well, make that number bigger Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 11, 2019 Share Posted June 11, 2019 Please make a demo ASAP because that sounds like Critical issue, we will be very happy to fix it. Quote Link to comment Share on other sites More sharing options...
mtorregrosa Posted June 11, 2019 Author Share Posted June 11, 2019 Thank you very much. You are right. I get the error if I make: new Graphics().beginFill(color, 1).drawPolygon(N vertices).endFill() with N >= 100 The problem is solved if PIXI.GraphicsGeometry.BATCHABLE_SIZE >= N+1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 11, 2019 Share Posted June 11, 2019 I still need demo from you, to fix non-batched branch of the code. Quote Link to comment Share on other sites More sharing options...
mtorregrosa Posted June 12, 2019 Author Share Posted June 12, 2019 Well... I have created the following demo: https://jsfiddle.net/ojc9nate/6/ But this demo works correctly. My application is not exactly like this, because it uses webpack for compilation, with the following dependency in my package.json file: "pixi.js": "^5.0.4" I really don't know what is the problem. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 12, 2019 Share Posted June 12, 2019 can you make a screenshots how it fails? Quote Link to comment Share on other sites More sharing options...
mtorregrosa Posted June 12, 2019 Author Share Posted June 12, 2019 I'm not able to attach images to the post. I always get the following error message: /var/www/html/uploads/monthly_2019_06 could not be created. The jpg file only has 350 KB in size. I have notified the problem to the forum managers. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 12, 2019 Share Posted June 12, 2019 take it with monosnap or any other tihngy and post a link here Quote Link to comment Share on other sites More sharing options...
mtorregrosa Posted June 12, 2019 Author Share Posted June 12, 2019 Finally I found the solution in 43061-poor-performance-on-panning. My polygon coords where too big (in the order of 10^8). What mostly misleaded me was that batched polygons where draw ok, but not batched ones where drawn wrong. I've solved the problem by making graphics.position equal to the polygon center and, consequently, reducing polygon coords in the order of 10^4. Thanks for your help. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 12, 2019 Share Posted June 12, 2019 Exactly like I said to you, heh 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.