GLTexture

A WebGL texture object.

Constructor

new L3D.GLTexture(gl, options)

Parameters
gl GLContext
options Object

Properties

hasMipmap bool

True if the texture has a mipmap.

numMipmapLevels number

The number of mipmap levels created for the texture.

Methods

blit(targetTexture, shader, uniforms)

Copy the contents of this texture to the given texture, optionally applying a shader.

Parameters
targetTexture GLTexture

Texture to copy to. If null, it will draw to the screen or active framebuffer.

shader GLShader

Optional shader to apply while copying

uniforms Object

Optional uniforms for the shader

generateMipmap()

Generate mipmaps for the texture. The texture should currently be bound to the active texture.

init(options)

Initialize the texture with the given set of options.

Parameters
options Object

readPixels(pixels) → Uint8Array

Download pixels from the texture to a local buffer.

Parameters
pixels Uint8Array

Optional storage for the pixels. The size should be width * height * 4.

Returns
Uint8Array