========================= The Libvob memory manager ========================= This document explains the memory manager used in libvob to manage **OpenGL texture memory**. Other memory management is done using Java and C++ normally. Mipzips - loading textures at reduced resolutions ------------------------------------------------- The basic premises of texture memory are: - Textures can be loaded at different resolutions, making a tradeoff between quality and space. - Space is rather limited, as it's best to have the whole working set of textures on the video card. When using Libvob in a system where there are several pictures, it is useful to be able to dynamically load and unload different **levels of detail** (this is a common term in Computer Graphics). For performance and simplicity, Libvob currently uses mipmap level granularity for loading and unloading of textures: for being able to draw an image correctly at different scales, the graphics cards require a set of *mipmaps* to be stored in the graphics memory; the mipmaps start from the largest texture (both sides must be powers-of-two) and each successive mipmap level divides the size of the sides by two, requiring one fourth of the space of the preceding level. We have chosen to store all mipmap levels of a texture in a .zip file and load on demand the requested levels. The MipzipLoader class implements a basic interface to this functionality: .. UML:: mipziploader class MipzipLoader assoc compos - multi(1) java.util.zip.ZipFile assoc compos - multi(1) GL.Texture methods loadToBaseLevelSynch setGoalBaseLevel getMemory() getMemory(int level) getLevelForBytes(int memory) getLevelForQuality(float quality) class java.util.zip.ZipFile class GL.Texture --- horizontally(40, xxxx, GL.Texture, java.util.zip.ZipFile); vertically(60, yyyy, MipzipLoader, xxxx); The class uses the Background and the OpenGL backgrounding functionality to load the textures, but the complications will not be described here. MemoryPartitioner - dividing memory between mipzips ---------------------------------------------------