BaseTexture2D

BaseTexture2D

Base class for all 2D texture related subclasses. Stores texture parameters and a webgl texture object.
set BaseTexture2D#needsUpdate true if any member has changed.
the webgl texture will be updated at the next time it is used with BaseTexture2D#setActive.

subclasses : Texture2D, DataTexture2D.

Constructor

new BaseTexture2D()

Source:

Members

internalFormat :String

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

magFilter

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

minFilter

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

needsUpdate :Boolean

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

pixelType :String

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

sourceFormat :String

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

texture :WebGLTexture

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

useMipmaps :Boolean

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

wrapS :String

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

wrapT :String

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

Methods

init(gl)

Source:
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:
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

(abstract) update(gl)

Source:
updates texture data and parameters.
Actual update of texture data must be implemented in a subclass!.
BaseTexture2D only implements assigning texture parameter values.
Parameters:
Name Type Description
gl WebGLRenderingContext