Hi there,
My first post here.
I tried to assign different canvas for different polygons but for some reason - it gave them the same canvas.
So, I tried to create a simple problem - two polygons with different colors based on canvas. The result is that they get the same color..:\
Here is the code:
var viewer = new Cesium.Viewer('cesiumContainer');
var canvas1 = document.createElement('canvas');
canvas1.height = 100;
canvas1.width = 100;
var context = canvas1.getContext('2d');
context.rect(0,0,100,100);
context.fillStyle = 'red';
context.fill();
var canvas2 = document.createElement('canvas');
canvas2.height = 100;
canvas2.width = 100;
var context2 = canvas2.getContext('2d');
context2.rect(0,0,100,100);
context2.fillStyle = 'yellow';
context2.fill();
viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0,
-115.0, 32.0,
-107.0, 33.0,
-102.0, 31.0,
-102.0, 35.0]),
material : canvas1
}
});
viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-30.0, 37.0,
-20.0, 32.0,
-10.0, 33.0]),
material : canvas2
}
});
viewer.zoomTo(viewer.entities);
Help?