maassk Posted December 9, 2020 Share Posted December 9, 2020 Hello, I am new with Pixi.js and I have a problem with adding new graphic dynamically. There is no problem with drawing large number of rectangles all at once but when I try to draw them in a batches when responce from socket.io server comes, then app is crashing at some point due to out of memory. Any advices on drawing graphics dynamically from a callback function? Thank you in advance! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 9, 2020 Share Posted December 9, 2020 > when I try to draw them in a batches when responce from socket.io server comes, PixiJS has a scene, and it draws scene only when "renderer.render()" is called. If you are talking about "graphics.drawRect", you actually adding one more rect into graphics storage, not removing all the previous ones. Graphics is clear&refill system, where are you doing clear? What exactly are you doing in that response? maassk 1 Quote Link to comment Share on other sites More sharing options...
maassk Posted December 11, 2020 Author Share Posted December 11, 2020 Thank you for this tip. I have implemented clear and also multiple graphics objects and now it works like a charm!! Thank you once again. Btw. can you recommend any source of knowledge (book, course etc.) where this stuff is deeply explained? 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.