Jump to content

Graphics.drawPolygon max vertices


mtorregrosa
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 ;)

 

Link to comment
Share on other sites

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.

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