Texture

cjcliffe edited this page Oct 15, 2011 · 4 revisions

CubicVR.Texture

The Texture class provides a container and loader for images. Textures can be applied to a Material or subclasseed for advanced integration such as the case of PJSTexture.

Constructor:

Texture( img_path, filter_type )

Parameters:

  • img_path : The path to an image, either relative or absolute, i.e. ./images/brick.jpg or http://mydomain.com/brick.jpg.
  • filter_type : Filter type to set for this image, see setFilter for possible enums.

Methods:

setFilter( filter_type )

Set the filter type for the texture (interpolation)

Parameters:

  • filter_type : The filter type to set the texture to, options are one of the following CubicVR.enums:
    • enums.texture.filter.LINEAR
    • enums.texture.filter.LINEAR_MIP (default)
    • enums.texture.filter.NEAREST
    • enums.texture.filter.NEAREST_MIP

Returns:

none

use( texture_unit )

Activate the texture using the given WebGL texture_unit, valid inputs are gl.TEXTURE{x}.

Returns:

none

clear()

Clear the texture from it's last use, bind a null in it's place.

Returns:

none