-
-
Save davschne/663b744abd5522b7f5dc67a22fa85783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// construct the pixel data | |
const floatArray = new Float32Array([ /* pixels */ ]); | |
const uintArray = new Uint8Array(floatArray.buffer); | |
// bind the pixel data to a WebGL texture | |
gl.texImage2D( | |
gl.TEXTURE_2D, // target | |
0, // mipmap level | |
gl.RGBA, // internal format: 4 color channels | |
width, // width of texture in pixels | |
height, // height of texture in pixels | |
0, // border: must be 0 | |
gl.RGBA, // format: must be the same as internal format | |
gl.UNSIGNED_BYTE, // type: 8 bits per channel | |
uintArray, // pixels | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment