Jump to content

graphics.drawRect stops working after about 4096 calls


farzher
 Share

Recommended Posts

My grid is supposed to have 50 rows, but it stops rendering near the end of the 41st row.
If I reduce the width of each row then it renders a bit more rows

SCgkm3E.png
Here's my code

 

gXp3cgv.png


Is there a limit to the number of draw calls I can do on a single graphics object? It's interesting that it breaks at 4096 calls, exactly 12 bits.

How am I supposed to render this grid?
 

Link to comment
Share on other sites

I believe you might be losing width/height from pixels in the line around the grid squares. Add the pixel width of your lines from either side of width, and height to your width, and height in the loop. :)

 

You might only need to add one, or the other.

I don't think that's the problem.That's just making the tiles overlap a bit, but look at the bottom right. There's 4 tiles just missing, that's where the problem starts.

although, if I comment out the linestyle, everything works (grid renders a bunch more tiles vertically) o_O

Link to comment
Share on other sites

To be honest there are a number of issues with the current way PIXI.Graphics draws primitives, but essentially you've a couple of options:

 

1) Don't use Graphics for the Grid. A BitmapData would be a single texture, easy to draw to, and won't exhibit this problem.

 

2) Don't draw rects. Draw the horizontal and vertical lines. Then you don't need half as many draw calls.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...