Reading pixels from the offscreen framebuffer
We can go now to the offscreen buffer and read the color from the coordinates that we clicked on the canvas.
WebGL allows us to read back from a framebuffer using the readPixels
function. As usual, having gl
as the WebGL context variable:
Function |
Description |
---|---|
|
According to the WebGL specification at the time of writing this book it needs to... |