Class vxlTexture

A vxlTexture is a representation of a raster image in Voxelent.

Constructor

vxlTexture(uri)

A vxlTexture is a representation of a raster image in Voxelent. Textures can be loaded providing a URI

To set the magnification and minification filters for a texture please refer to the constants defined in vxl.def.texture.filter. A vxlTexture object uses the min and mag properties to set these filters. For example:

var texture = new vxlTexture('iphone_screen.png');
texture.min = vxl.def.texture.filter.LINEAR;
texture.mag = vxl.def.texture.filter.NEAREST;

The maginfication and minification filters by default are: vxl.def.texture.filter.LINEAR and vxl.def.texture.filter.LINEAR_MIPMAP_LINEAR respectively

Under normal circumstances you will not need to create a vxlTexture. An actor representing a model with texture information in it will create a vxlTexture automatically. In this case you can access the available vxlTexture object from the actor like this:

var actor = vxl.c.scene.getActorByName('iphone_screen.json');
actor.texture.min = [set the filter here using the constants defined in vxl.def.texture.filter]
actor.texture.mag = [set the filter here using the constants defined in vxl.def.texture.filter]

If you want to replace the texture object with a new raster image, you can write something like this:

var actor = vxl.c.scene.getActorByName('iphone_screen.json');
var wallpaper = new vxlTexture('new_wallpaper.png');
actor.setTexture(wallpaper);

Author: Diego Cantor.

Parameters:

String uri

texture location

Methods

.getMagFilter(gl)
Returns the appropriate gl constant that identifies the current magnification filter applied to this texture

Parameters:

Type Name Description
Object gl

the gl context

.getMinFilter(gl)
Returns the appropriate gl constant that identifies the current minification filter applied to this texture

Parameters:

Type Name Description
Object gl

the gl context

.load(uri)
Loads an image and it associates it to this texture object

Parameters:

Type Name Description
Object uri

the location of the image to load into this texture object

.setMagFilter(magfilter)
Sets the magnification filter.

Parameters:

Type Name Description
String magfilter

one of the options in vxl.def.texture.filter

See:

.setMinFilter(minfilter)
Sets the minification filter.

Parameters:

Type Name Description
String minfilter

one of the options in vxl.def.texture.filter

See: