Pannellum: Error: WebGL warning: <SetDimensions>: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

Created on 12 Dec 2018  Â·  7Comments  Â·  Source: mpetroff/pannellum

Hi Matthew

Thank you for your help earlier this week. Another question for you.

I have VR tour that uses six pannellum instances that are in turn destroyed and replaced with new instances. Over a period of time, and seemingly at random, Firefox is reporting .....

Error: WebGL warning: : Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

There is no loss of performance, but I suspect that the same issue is causing safari on my iPhone crash.

So I have been doing some testing. Firefox copes with up to 16 pannellum instances open on one page (until the browser is refreshed). Any more and the WebGL warning appears.

In my tour I'm using the .destroy() function in the API, so I tried to use this command. Creating the first 8 pannellum instances, destroying the first 4, and then creating another 8 pannellum instances.

The .destroy() removes the pannellum instance, but the WebGL warning still appears.

I even tried using javascript to remove the DIV in which the pannellum instance is loaded, but with the same WebGL warning.

Can you suggest any way to overcome this?

Perhaps the .destroy() call has not completed it's work before I load the new pannellum view. Is there a way to test if the pannellum has been destroyed before loading it's replacement?

Kind regards

Derek

question

All 7 comments

There's no way to avoid the warning, as far as I know. Just reloading the same page more than sixteen times causes it (including the WebGL test page), so it seems to be related to how Firefox handles WebGL instances internally (I first came across this warning years ago).

Generally, I wouldn't recommend creating a large number of viewers (or any sort of WebGL context) on the same page simultaneously, due to the performance and battery usage implications. Although I haven't done any rigorous testing, I think it's better to reuse an existing Pannellum instance when possible instead of destroying it and creating a new one.

Thank you Matthew for quick reply.

I'll experiment with dynamically adding and removing tour scenes.

Kind regards

Derek

@DStillingfleet @mpetroff
i am working on app which loads large number of streams on one screen and there is a possibility that at a certain time quality of video should be changed and therefore url should be changed.
long story short: app should load multiple streams on one screen and eventually change them with best user experience.

i am having same issue and i resolved it by manually releasing webgl context.
this should help:
document.getElementById('myCanvas').getContext('webgl').getExtension('WEBGL_lose_context').loseContext();
of course you should add:
player.destroy() afterwards

and if necessary (as in my case) you can reinitialize player in same element so to speak.

tested in chrome task manager by looking at GPU memory resources.

btw i solved this in vanillaJS but later implemented in angular7 app

@kresimirfijacko Pannellum's viewer.destroy() method already does that.

Thank you for offering a suggestion on this kresimirfijacko.

I've currently worked around this problem by dynamically adding scenes so as not to reach the 16 webgl canvas limit.

@DStillingfleet any progress there?

Hi Matthew

Great to hear from you. Hope you and all yours are well.

I worked around this problem. Instead of creating new Pannellum viewers and destroying old Pannellum viewers, I am dynamically adding scenes to a tour.

This works well with six Pannellum instances.

I’m curious why you ask, is there something new you are working on?

Best wishes

Derek

From: ProgrammingLife [mailto:[email protected]]
Sent: 02 April 2020 04:49
To: mpetroff/pannellum pannellum@noreply.github.com
Cc: Derek Stillingfleet Derek@VirtualMountains.co.uk; Mention mention@noreply.github.com
Subject: Re: [mpetroff/pannellum] Error: WebGL warning: : Exceeded 16 live WebGL contexts for this principal, losing the least recently used one. (#695)

@DStillingfleet https://github.com/DStillingfleet any progress there?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/mpetroff/pannellum/issues/695#issuecomment-607605459 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AC47ZDCE5YVCSFIQCSKPSADRKQDLFANCNFSM4GKCEQTQ . https://github.com/notifications/beacon/AC47ZDC4ABB4YLPK7MCVSDLRKQDLFA5CNFSM4GKCEQT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEQ3VFUY.gif

Was this page helpful?
0 / 5 - 0 ratings

Related issues

truszko1 picture truszko1  Â·  5Comments

clarknelson picture clarknelson  Â·  5Comments

DietRedThunder picture DietRedThunder  Â·  6Comments

JamesHurburgh picture JamesHurburgh  Â·  3Comments

DStillingfleet picture DStillingfleet  Â·  8Comments