readPixels returning undefined


var pixel = gl.readPixels(1,1,1,1,gl.RGBA,gl.UNSIGNED_BYTE);


var pixel;
gl.readPixels(1,1,1,1,gl.RGBA,gl.UNSIGNED_BYTE, pixel);

evaluate pixel to “undefined”

I am trying to implement color-based picking. This occurs on both Webkit Nightly and Chrome.

Anyone got any information on this? Or if I need to use it differently?

pixel needs to be an allocated array-object:

var pixel = new Uint8Array(4);

that should work