Classes
Methods
(static) TEX.deleteTextureBuffer(gl, texture)
Takes in the WebGL context and a Texture. Deletes the texture buffer,
which you would do when deleting an object from a scene so that you don't leak video memory.
The deleted texture attribute is:
Attribute | Description textureBuffer| A WebGLTexture object to which the image is bound to.Note: You are able to use TEX.initTextureBuffer again in order recreate a texture buffer Excessive buffer creation and deletion leads to video memory fragmentation. Beware.
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The WebGLRenderingContext |
texture |
Texture | A single 'TEX.Texture' instance |
- Source:
(static) TEX.downloadTextures(nameAndURLs, completionCallback, textures)
Takes in an Javascript object of ['texture_name': '/url/to/TEX/file'] pairs and a callback
function. Each image file will be ajaxed in and automatically converted to
an TEX.Texture Object. When all images have been successfully downloaded the callback
function provided will be called and passed in an Javascript object containing
the newly created TEX.texture Objects of ['texture_name': TEX.Texture] pairs.
Note: Cross Origin Resource Sharing (CORS) is enabled. You may request images from other domains, iff the requested domain allows CORS. That is up to the server. Github pages give permission, flickr.com gives permission, imgur.com gives permssion, but most websites do not. Note: In order to use this function as a way to download textures, a webserver of some sort must be used.The URL path for loading images provided by the Editor always begins with: 'src/texture/[imageName].(jpg|png|gif|bmp)'. A list of all available images within the editor can be seen in the menu under sources -> texture.
Parameters:
Name | Type | Description |
---|---|---|
nameAndURLs |
Object | An object where the key is the name of the texture and the value is the url to that image file |
completionCallback |
function | Should contain a function that will take one parameter: an object array where the keys will be the unique object name and the value will be a Texture object |
textures |
Object | In case other textures are loaded separately or if a previously declared variable is desired to be used, pass in a (possibly empty) json object of the pattern: { '< tex_name >': TEX.Texture } |
- Source:
(static) TEX.initTextureBuffer(gl, texture)
Takes in the WebGL context and a TEX Object, then creates and appends the texture buffer
to the texture object as a attribute.
The newly created texture attribute is:
Attribute | Description textureBuffer| A WebGLTexture object to which the image is bound to.Access the WebGLTexture object via texture.textureBuffer
Parameters:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The WebGLRenderingContext |
texture |
Texture | A single 'TEX.Texture' instance |
- Source: