Hello, I am trying to determine the color of a pixel at a certain location on the cesium canvas. The result is always the same, [0, 0, 0, 255]. I am using the latest version of chrome and cesium and am using Bing maps.
I will be using this to sample the map imagery under a screen overlay so it can dynamically be colored to contrast the map.
I have created a Github gist that can be copied and pasted into a Cesium Sandcastle.
Here is the code:
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var pixels = new Uint8Array(4);
… Other stuff …
var gl = viewer.canvas.getContext(‘webgl’);
gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
console.log(pixels); // always outputs 0,0,0,255
I have feeling this is not doing what I am expecting it is. This is my first time interacting with webgl.