Texture
Extends:
A Texture
Example:
// generate a 256x256 pixel texture of random colors
const size=256;
const data = new Uint8Array(size*size*4);
for(var x=0;x<size*size*4;x++) data[ x*4+3]=255;
const tex=new CGL.Texture(cgl);
tex.initFromData(data,size,size,CGL.Texture.FILTER_NEAREST,CGL.Texture.WRAP_REPEAT);
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
anisotropic: number |
|
public |
deleted: boolean |
|
public |
filter: * |
|
public |
flip: boolean |
|
public |
flipped: boolean |
|
public |
height: * |
|
public |
image: * |
|
public |
loading: boolean |
|
public |
pixelFormat: * |
|
public |
shadowMap: boolean |
|
public |
|
|
public |
tex: * |
|
public |
texTarget: * |
|
public |
textureType: * |
|
public |
unpackAlpha: boolean |
|
public |
width: * |
|
public |
wrap: * |
Private Members | ||
private |
_cgl: * |
|
private |
_fromData: boolean |
|
private |
|
|
private |
_glDataType: * |
|
private |
|
|
private |
_log: * |
Method Summary
Public Methods | ||
public |
returns a new texture with the same settings (does not copy texture itself) |
|
public |
compareSettings(tex: Texture): Boolean returns true if otherTexture has same options (width/height/filter/wrap etc) |
|
public |
delete() |
|
public |
dispose() delete texture. |
|
public |
getInfo(): * |
|
public |
getInfoOneLine(): * |
|
public |
getInfoOneLineShort(): * |
|
public |
getInfoReadable(): * |
|
public |
initFromData(data: Array<Number>, w: Number, h: Number, filter: Number, wrap: Number) |
|
public |
initTexture(img: Object, filter: Number) set texture data from an image/canvas object |
|
public |
isFloatingPoint(): * |
|
public |
isPowerOfTwo(): Boolean |
|
public |
|
|
public |
setFormat(o: *) |
|
public |
setSize(w: Number, h: Number) set pixel size of texture |
|
public |
|
Private Methods | ||
private |
|
Inherited Summary
From class CgTexture | ||
public |
height: number |
|
public |
id: * |
|
public |
name: string |
|
public |
pixelFormat: * |
|
public |
width: number |
Public Constructors
Public Members
public anisotropic: number source
public deleted: boolean source
public filter: * source
public flip: boolean source
public flipped: boolean source
public image: * source
public loading: boolean source
public shadowMap: boolean source
public shortInfoString: * source
public tex: * source
public texTarget: * source
public textureType: * source
public unpackAlpha: boolean source
public wrap: * source
Private Members
private _cgl: * source
private _fromData: boolean source
private _glDataFormat: * source
private _glDataType: * source
private _glInternalFormat: * source
private _log: * source
Public Methods
public clone(): Texture source
returns a new texture with the same settings (does not copy texture itself)
public compareSettings(tex: Texture): Boolean source
returns true if otherTexture has same options (width/height/filter/wrap etc)
Params:
Name | Type | Attribute | Description |
tex | Texture | otherTexture |
Return:
Boolean |
public delete() source
public initFromData(data: Array<Number>, w: Number, h: Number, filter: Number, wrap: Number) source
Params:
Name | Type | Attribute | Description |
data | Array<Number> | rgb color array [r,g,b,a,r,g,b,a,...] |
|
w | Number | width |
|
h | Number | height |
|
filter | Number | ||
wrap | Number |
public initTexture(img: Object, filter: Number) source
set texture data from an image/canvas object
Params:
Name | Type | Attribute | Description |
img | Object | image |
|
filter | Number |
public printInfo() source
public setFormat(o: *) source
Params:
Name | Type | Attribute | Description |
o | * |
public setSize(w: Number, h: Number) source
set pixel size of texture
Params:
Name | Type | Attribute | Description |
w | Number | width |
|
h | Number | height |