Skip to content

TextureReader

Reader of image texture

Helper class reading data from texture. Used withing image processing pipeline to get texture data on the client side.

new TextureReader(gl): TextureReader

Constructor

WebGL2RenderingContext

WebGL context where program is instantiated

TextureReader

protected frameBuffer: null | WebGLFramebuffer = null

Frame buffer


protected gl: WebGL2RenderingContext

WebGL context where program is instantiated


protected pixelBuffer: null | WebGLBuffer = null

dispose(): void

Dispose texture reader

Releases resources and instances allocated by reader. Reader object cannot be used after calling dispose().

void


read(image, level): null | Uint8Array<ArrayBuffer>

Read texture data

ImageTexture

Image texture

number = 0

Mipmap level

null | Uint8Array<ArrayBuffer>

Texture data


readAsync(image, level): Promise<null | Uint8Array<ArrayBuffer>>

Non-blocking read of texture data

ImageTexture

Image texture

number = 0

Mipmap level

Promise<null | Uint8Array<ArrayBuffer>>

Texture data