UNPKG

@thi.ng/webgl

Version:

WebGL & GLSL abstraction layer

18 lines (17 loc) 426 B
import { FBO } from "./fbo.js"; const readPixels = (gl, x, y, w, h, format, type, out) => { gl.readPixels(x, y, w, h, format, type, out); return out; }; const readTexture = (gl, tex, format, type, out) => { const fbo = new FBO(gl, { tex: [tex] }); fbo.bind(); gl.readPixels(0, 0, tex.size[0], tex.size[1], format, type, out); fbo.unbind(); fbo.release(); return out; }; export { readPixels, readTexture };