WebGL context in MapViewers on web app

Hi

Xojo 2026.r1.2 Xojo Web Project

I have a question on too many webGL contexts on a dashboard with multiple WebMapViewers. I don’t reload them and they drop off as newer WebGL contexts and I get a sad face on PCs (not usually on Macs).

[Error] There are too many active WebGL contexts on this page, the oldest context will be lost.
	getContext
	_setupPainter (maplibre-gl-x10bc4046111b1056.js:46:414296)
	(anonymous function) (maplibre-gl-x10bc4046111b1056.js:46:396457)
	render (Xojo-xf7cd07146d6aa4b3.js:9861)
	refreshCallback (Xojo-xf7cd07146d6aa4b3.js:2727)
	doControlRefreshes (Xojo-xf7cd07146d6aa4b3.js:2990)

What’s the general advice on this? Yes, I know I could just use one MapViewer, but I want to see if I can get a solution working.

Should I use a placeholder ImageViewer until the MapViewer is needed and switch between them?

Or should I hide the MapViewers when the dashboard is not visible and then show when visible?

thanks for any advice.

Michelle

Michelle,

I had a look at Documentation and searched for WebGL, nothing was found.

It seems that the error text is in error. In the messahe you inserted, one can read

Can it be that WebGL would be MapGL of MaplibreGL ?

I can’t imagine what you’re trying to achieve, but maybe you could have one or two WebMapViewer offscreen, then call WebMapViewer.ToPicture and send the resultant image to WebImageViewer.

I have a MainPage dashboard with 4 listboxes. Above each listbox is a maplibre mapViewer which loads a map and places a pin at the location of the selected row in the listbox. Users can interact with the map to zoom in, pan or select a pin and open another page.

After 30mins of use on PCs, the dashboard maps go white with a sad face icon. The errors in the browser console are “too many too many active WebGL contexts”. I am trying to stop this happening.

Some suggestions I’ve heard are to use a starting map image in an imageViewer and only show the map view when a row is selected in a listbox.

The MainPage is refreshed when something needs to be updated (rows move from one listbox to the next), but other than that, I show the existing MainPage when returning from other web pages.

I hope this explains it better.

thanks!

Thanks for the explanation.

Is there a way you can extract a sample project? I’d like to double check this isn’t a framework bug.

Yes I will put a sample project together.

thanks!

1 Like

@Michelle_Parker I’ve been able to reproduce the bug thanks to your explanation, and provided a sample project in Issue #81736

Could you please confirm if that’s the issue you’re seeing?

Great! That’s it, thanks for doing that!

1 Like