Texture - noobgl/noobgl GitHub Wiki

The texture allows you to defines samplers to use from the gpu.

Import

import { Texture } from "noobgl";

Constructor

new Texture(context, source);
  • context the WebGL2 context of a canvas.
  • source the source of the pixel data
    • HTMLImageElement
    • HTMLCanvasElement
    • HTMLVideoElement
    • ImageBitmap
    • ImageData
    • ArrayBufferView

Properties

context the WebGL2 context of a canvas.

source the source of the pixel data.

location the location id attributed to the gpu.

instance the native texture instance initiated with the context.

Methods

.bind()

Makes the context pointer on the texture.

.update()

Update the texture on the gpu from the source.

.setParameter(parameter, value)

Set a parameter to the texture (list of WebGL texture's parameters and values).

  • parameter the WebGL parameter to apply.
  • value the WebGL parameter value to apply.
.setPixelStorageParameter(name, value)

Set a parameter to the pixel store (list of WebGL pixel store's parameters and values).

.getParameter(parameter)

Get a parameter of the texture (list of WebGL texture's parameters).

  • parameter the WebGL parameter to get.
.delete()

Delete the texture.