Marian Posted July 11, 2019 Share Posted July 11, 2019 Hello, I'm creating a web-component with pixijs, just now I ' want use this multiply on my webpage but I can only 16 times this create and I take a warning : "ContextSystem.js:118 WARNING: Too many active WebGL contexts. Oldest context will be lost." How many WebGl context or PIXI.Application can I create on one time ? Thanks Marian Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 11, 2019 Share Posted July 11, 2019 3 webgl, as many as you want canvas contexts. Also about pixijs Application, its better to know what is it : https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop Quote Link to comment Share on other sites More sharing options...
TheBoneJarmer Posted July 11, 2019 Share Posted July 11, 2019 I experienced this error as well in the past, was not with Pixi though but with my own very basic framework. In my case the browser refused to call WebGL methods after refreshing the page too many times on a short time. Probably because I put the entire thing too much on pressure. What worked for me was refreshing the cache with Ctrl+F5 or restarting my browser. Quote Link to comment Share on other sites More sharing options...
Marian Posted July 15, 2019 Author Share Posted July 15, 2019 Hi, thanks .. I'm make simply test and create 20 times : var app = new PIXI.Application({ antialias: true }); document.body.appendChild(app.view); var graphics = new PIXI.Graphics(); // Rectangle graphics.beginFill(0xDE3249); graphics.drawRect(50, 50, 100, 100); graphics.endFill(); app.stage.addChild(graphics); ... and I'm take the same warning: "Too many active WebGL contexts. Oldest context will be lost." same behavir with only create renderer (20 times): rend = new PIXI.Renderer({ width: 100, height: 60, backgroundColor: 0x1099bb }); document.body.appendChild(rend.view); . . . . seems like limit from WebGL ? someone a idea ? can I have multiple canvas (20) with only one renderer ? Thanks ! Quote Link to comment Share on other sites More sharing options...
Exca Posted July 15, 2019 Share Posted July 15, 2019 Browsers have limits on webgl context amounts (the actual amount depends on many factors). You can use 2d canvas if rendering deosnt require webgl. Single context can be used only in a single canvas. Quote Link to comment Share on other sites More sharing options...
cpu_sam Posted July 15, 2019 Share Posted July 15, 2019 Are you using firefox? That is a bug not solved in the browser. Chromw has not this bug, for this I use chrome on dev of my game. Here talk that bug was solved, but in new versions of firefox it still persists: https://bugzilla.mozilla.org/show_bug.cgi?id=637449 Quote Link to comment Share on other sites More sharing options...
xerver Posted July 15, 2019 Share Posted July 15, 2019 As Exca mentioned this is an actual browser limitation. There is a limit to the number of WebGL contexts you are allowed to create in a single page. The actual number depends on your environment and browser. Quote can I have multiple canvas (20) with only one renderer ? No, one canvas has 1 renderer. Quote Link to comment Share on other sites More sharing options...
JEP Posted July 15, 2020 Share Posted July 15, 2020 I experienced the same issue but why in this website https://orkestra.ca/en/team-and-careers they manage to use PIXI.Application() for multiple canvas more than 20 canvas. As I can see they used destroy() method after 16 item and then create again I have no idea is my conclusion is right. is anyone can provide a solution for this issue or limitation? Thanks, Quote Link to comment Share on other sites More sharing options...
Exca Posted August 3, 2020 Share Posted August 3, 2020 They are using 2d canvas, not 3d. 2d canvas has no limitations on amount as its run on the cpu and basically memory is the limiting factor in that. As a warning if you are going to do lots of canvases then you need to make sure they are updated only when needed. Otherwise your site will be very cpu heavy. 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.