Catch RuntimeError

Hi , I have a long list of contextual maps that are available to user for imagery overlays. If many of these are added at one time at a certain point I get
RuntimeError: Program failed to link. Link log: Pixel shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (16).

How do I trap this error so that I can disallow that final overlay but yet continue functioning? I do not call the rendering function myself, simply set show to true …

I would want to know WHICH overlay I was attempting at the time…

Function used to do the overlays:

var widget = new Cesium.CesiumWidget(‘cesiumContainer’);

var scene = widget.scene;

function addLayer(scene, url, layerName, alpha) {

var imageryLayers = scene.imageryLayers;

var provider = new Cesium.WebMapServiceImageryProvider({

url : url,

layers : layerName,

parameters : {

transparent : ‘true’,

format : ‘image/png’

},

proxy : new Cesium.DefaultProxy(‘proxy/?getUrl=’)

});

var newLayer;

try {

newLayer = imageryLayers.addImageryProvider(provider);

} catch (err){

alert(err.message);

return null;

}

var alphaSetting = alpha + 0;

newLayer.alpha = alphaSetting;

newLayer.show = true;

return newLayer;

}

Thanks!

Regards

Rencia

This should no longer be an issue in Cesium 1.0, which will be released in August 1. In the meantime, you could test it by pulling down the master Cesium branch from github.

Patrick

Thanks Patrick. Seems prudent to wait till August 1. Hopefully I can trap the error then with a simple try-catch ye?
Rgds

Rencia

Oh Pardon. I see the release notes for version 1 say:
Cesium can now render an unlimited number of imagery layers, no matter how few texture units are supported by the hardware

Cheers