Kiwi.Renderers.GLTextureManager Class
Manages GL Texture objects, including creation, uploading, destruction and memory management
Constructor
Kiwi.Renderers.GLTextureManager
()
GLTextureManager
Returns:
Item Index
Methods
Methods
_addTextureToCache
-
glTexture
Adds a texture wrapper to the cache
Parameters:
-
glTexture
GLTextureWrapper
_deleteTexture
-
gl
-
idx
Deletes a texture from memory and removes the wrapper from the cache
Parameters:
-
gl
WebGLRenderingContext -
idx
Number
_freeSpace
-
gl
-
numBytesToRemove
Attemps to free space for to uplaod a texture. 1: Try and find texture that is same size to remove 2: Find next smallest to remove (not yet implemented) 3: Sequentially remove until there is room (not yet implemented)
Parameters:
-
gl
WebGLRenderingContext -
numBytesToRemove
Number
Returns:
boolean
_uploadTexture
-
gl
-
glTextureWrapper
Uploads a texture to video memory
Parameters:
-
gl
WebGLRenderingContext -
glTextureWrapper
GLTextureWrapper
Returns:
boolean
clearTextures
-
gl
Removes all textures from video memory and clears the wrapper cache
Parameters:
-
gl
WebGLRenderingContext
uploadTextureLibrary
-
gl
-
textureLibrary
Uploads a texture library to video memory
Parameters:
-
gl
WebGLRenderingContext -
textureLibrary
Kiwi.Textures.TextureLibrary
useTexture
-
gl
-
glTextureWrapper
-
textureSizeUniform
Binds the texture ready for use, uploads it if it isn't already
Parameters:
-
gl
WebGLRenderingContext -
glTextureWrapper
GLTextureWrappery -
textureSizeUniform
Number
Returns:
boolean
Properties
_textureWrapperCache
GLTextureWrapper
private
An array of references to all texture wrappers
DEFAULT_MAX_TEX_MEM_MB
Number
public
static
The default maximum amount of texture memory to use before swapping textures
maxTextureMem
Number
public
The maximum amount of texture memory to use before swapping textures, initialised from DEFAULT_MAX_TEX_MEM_MB
numTextureWrites
Number
public
The number of textures uploads in the last frame
usedTextureMem
Number
public
The amount of texture memory currently uplaoded
usedTextureMem
Number
public
The number of textures currently uplaoded