Skip to content

Commit dfba4ae

Browse files
committed
Extract pixel from correct location for a framebuffer
1 parent 15d7b9c commit dfba4ae

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/renderer/snapshot/WebGLSnapshot.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ var WebGLSnapshot = function (sourceCanvas, config)
4141
{
4242
var pixel = new Uint8Array(4);
4343

44-
gl.readPixels(x, bufferHeight - y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
44+
var destY = (isFramebuffer) ? y : bufferHeight - y;
45+
46+
gl.readPixels(x, destY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
4547

4648
callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255));
4749
}

0 commit comments

Comments
 (0)