Texture2D

Texture2D

This class is intended to only display loaded images. For displaying data buffers use DataTexture2D.

Constructor

new Texture2D(url)

Source:
Parameters:
Name Type Description
url String path to image to load.

Extends

Members

internalFormat :String

Source:
Overrides:
Default Value:
  • 'RGBA'
See:
internal pixel format for webgl.
Type:
  • String

magFilter

Source:
Inherited From:
Default Value:
  • 'NEAREST'
See:
GL magnification filtering. Affects how a texel is rendered if it is bigger than screen pixel.

minFilter

Source:
Inherited From:
Default Value:
  • 'NEAREST'
See:
GL minification filtering. Affects how a texel is rendered if it is smaller than screen pixel.

needsUpdate :Boolean

Source:
Inherited From:
if true webgl texture object is updated the next time BaseTexture2D#setActive is called.
Type:
  • Boolean

pixelType :String

Source:
Overrides:
Default Value:
  • 'UNSIGNED_BYTE'
See:
pixel data type.
Type:
  • String

sourceFormat :String

Source:
Overrides:
Default Value:
  • 'RGBA'
See:
source pixel format for webgl. (same as BaseTexture2D#internalFormat for WebGL1).
Type:
  • String

texture :WebGLTexture

Source:
Inherited From:
webgl texture object. This will be created by BaseTexture2D#init.
Type:
  • WebGLTexture

useMipmaps :Boolean

Source:
Inherited From:
Default Value:
  • false
wether to create mipmaps on next update. mipmapping only works on power of 2 sized textures!
Type:
  • Boolean

wrapS :String

Source:
Inherited From:
Default Value:
  • 'REPEAT'
GL Wrapping on S coordinate.
Type:
  • String

wrapT :String

Source:
Inherited From:
Default Value:
  • 'REPEAT'
GL Wrapping on T coordinate.
Type:
  • String

Methods

init(gl)

Source:
Inherited From:
Creates the WebGLTexture instance. There is no need to call this manually in most cases. It is called from BaseTexture2D#setActive if needed.
Parameters:
Name Type Description
gl WebGLRenderingContext

setActive(gl, textureUnit)

Source:
Inherited From:
Initializes and updates this texture if necessary and then binds it to given texture unit. This is used internally when ShaderProgram sets a texture uniform.
Parameters:
Name Type Description
gl WebGLRenderingContext
textureUnit Number

update(gl)

Source:
Overrides:
Updates webgl texture data and parameters.
Parameters:
Name Type Description
gl WebGLRenderingContext