Created
May 5, 2016 13:16
-
-
Save ZacBrownBand/f42c1540b14dec49da876350cbec1f6f to your computer and use it in GitHub Desktop.
Picks the color of a pixel from a cesium viewer canvas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var viewer = new Cesium.Viewer('cesiumContainer'); | |
var scene = viewer.scene; | |
var context = scene.context; | |
var readColor = false; | |
scene.postRender.addEventListener(function() { | |
if (readColor) { | |
readColor = false; | |
var pixels = context.readPixels({ | |
x : 0, | |
y : 0, | |
width : 1, | |
height : 1 | |
}); | |
console.log(pixels); | |
} | |
}); | |
Sandcastle.addToolbarButton('Get Color', function() { | |
readColor = true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment