API Docs for: 1.0.1
Show:

Kiwi.Renderers.GLTextureManager Class

Module: Renderers
Parent Module: Kiwi

Manages GL Texture objects, including creation, uploading, destruction and memory management

Constructor

Kiwi.Renderers.GLTextureManager

() GLTextureManager

Returns:

GLTextureManager:

Methods

_addTextureToCache

(
  • glTexture
)
private

Adds a texture wrapper to the cache

Parameters:

  • glTexture GLTextureWrapper

_deleteTexture

(
  • gl
  • idx
)
private

Deletes a texture from memory and removes the wrapper from the cache

Parameters:

  • gl WebGLRenderingContext
  • idx Number

_freeSpace

(
  • gl
  • numBytesToRemove
)
public

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
)
private

Uploads a texture to video memory

Parameters:

  • gl WebGLRenderingContext
  • glTextureWrapper GLTextureWrapper

Returns:

boolean

clearTextures

(
  • gl
)
public

Removes all textures from video memory and clears the wrapper cache

Parameters:

  • gl WebGLRenderingContext

uploadTextureLibrary

(
  • gl
  • textureLibrary
)
public

Uploads a texture library to video memory

Parameters:

useTexture

(
  • gl
  • glTextureWrapper
  • textureSizeUniform
)
public

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