Class: Texture

Texture

Texture

new Texture(image) → {Texture}

A Texture represents pixel data for shaders and provides management for intelligently uploading images.
Parameters:
Name Type Description
image Image An optional Image element. Images may also be swapped at runtime, but the apply function must be called.
Author:
  • thegoldenmule
Source:
Returns:
Type
Texture

Members

filterLinear :boolean

If true, uploads with linear filtering, otherwise with nearest.
Type:
  • boolean
Source:

flipY :boolean

If true, flips the texture vertically.
Type:
  • boolean
Source:

glTexture :WebGLTexture

The glTexture object. This is created and managed internally.
Type:
  • WebGLTexture
Source:

image :Image

The HTML Image object to act as the source.
Type:
  • Image
Source:

mipmapLinear :boolean

If true, mipmaps use linear filtering, otherwise, nearest.
Type:
  • boolean
Source:

Methods

apply()

Must be called after the source image has been updated.
Source:

clearBuffers()

Called when the WebGLContext has been lost.
Source:

getHeight() → {Number}

Returns the height of the Texture.
Source:
Returns:
Type
Number

getWidth() → {Number}

Returns the width of the Texture.
Source:
Returns:
Type
Number

prepareTexture(ctx)

Called to prepare Textures for a context. This method will not bind textures or create buffers if unnecessary.
Parameters:
Name Type Description
ctx WebGLContext The context to prepare for.
Source:

pushTexture(ctx, shader, textureNum)

Pushes the texture buffer to the GPU.
Parameters:
Name Type Description
ctx WebGLContext The context to push to.
shader Shader The Shader to grab pointers from.
textureNum Number Each texture is associated with a number.
Source: