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 |
---|---|
|
|
Get WebGL Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.