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.