We can now go to the offscreen buffer and read the color from the appropriate coordinates:
![](https://static.packt-cdn.com/products/9781788629690/graphics/assets/bf13007d-f3f2-452c-bdc7-9b4d40ad0772.png)
WebGL allows us to read back from a framebuffer using the readPixels function. As usual, having gl as the WebGL context variable within our context:
Function | Description |
gl.readPixels(x, y, width, height, format, type, pixels) |
|
Remember that...