Enumerations | |
enum | UL_BANKS { UL_BANK_A = 0x1, UL_BANK_B = 0x2, UL_BANK_C = 0x4, UL_BANK_D = 0x8, UL_BANK_E = 0x10, UL_BANK_F = 0x20, UL_BANK_G = 0x40, UL_BANK_H = 0x100, UL_BANK_I = 0x200 } |
enum | UL_BANK_TYPE { UL_BANK_TYPE_LCD = 1, UL_BANK_TYPE_TEXTURE = 2, UL_BANK_TYPE_TEXPAL = 4 } |
Functions | |
int | ulSetTexVramParameters (UL_BANKS activeBanks, void *baseAddr, int totalSize) |
int | ulSetTexPalVramParameters (UL_BANKS activeBanks, void *baseAddr, int totalSize) |
int | ulTexImage2D (int target, int empty1, int type, int sizeX, int sizeY, int empty2, int param, uint8 *texture) |
void | ulTexParameter (uint8 sizeX, uint8 sizeY, uint32 *addr, uint8 mode, uint32 param) |
int | ulGetTexParameter () |
int | ulGenTextures (int n, int *names) |
void | ulBindTexture (int target, int name) |
void | ulFreeTextures (int n, int *names) |
int | uluTexLoadPal (u16 *pal, u16 count, uint8 format) |
void | uluTexUnloadPal (u32 addr) |
void | ulBindTextureToGl (int target, int name) |
void | ulSetTexAlphaMask (int enable) |
void | ulChangeVramAllocation (UL_BANKS banks, UL_BANK_TYPE type) |
void * | ulReadTextureToMemory (int textureID, int sizeX, int sizeY, int type) |
void * | ulReadPaletteToMemory (int paletteID, int palCount) |
int | ulGetTexVramAvailMemory () |
int | ulGetTexVramUsedMemory () |
int | ulGetTexVramTotalMemory () |
int | ulGetTexPalAvailMemory () |
int | ulGetTexPalUsedMemory () |
int | ulGetTexPalTotalMemory () |
int | ulGetVertexAvailMemory () |
int | ulGetVertexUsedMemory () |
int | ulGetVertexTotalMemory () |
Variables | |
u8 | ul_optimizeTextureSize |
u8 | ul_initTexturesToZero |
enum UL_BANKS |
enum UL_BANK_TYPE |
int ulSetTexVramParameters | ( | UL_BANKS | activeBanks, | |
void * | baseAddr, | |||
int | totalSize | |||
) |
Changes the VRAM allocation parameters for textures. By default, it is allocated to bank A and is 128 kB wide.
activeBanks | Banks that will be allocated to texture memory. OR them to allocate several banks. Usually UL_BANK_A | UL_BANK_B. | |
baseAddr | Video memory base address. Usually (void*)0x06800000. If you select UL_BANK_B only, it will be 0x06820000 and so on. | |
totalSize | Total video memory size. For one bank (UL_BANK_A) it's 128 << 10, for two banks (UL_BANK_A | UL_BANK_B) it's 256 << 10, and so on. << 10 multiplies a number by 1024, meaning kilobytes. Should be a multiple of 16. |
Here are two lines: the first one is the default, the second one is the recommended for accessing the 256 kB of texture memory.
ulSetTexVramParameters(UL_BANK_A, VRAM_A, 128 << 10); ulSetTexVramParameters(UL_BANK_A | UL_BANK_B, VRAM_A, 256 << 10);
int ulSetTexPalVramParameters | ( | UL_BANKS | activeBanks, | |
void * | baseAddr, | |||
int | totalSize | |||
) |
Same as ulSetTexVramParameters but for palettes. Default is:
ulSetTexPalVramParameters(UL_BANK_F, VRAM_F, 16 << 10);
An equivalent for what VideoGL uses by default is:
ulSetTexPalVramParameters(UL_BANK_E, VRAM_E, 64 << 10);
int ulTexImage2D | ( | int | target, | |
int | empty1, | |||
int | type, | |||
int | sizeX, | |||
int | sizeY, | |||
int | empty2, | |||
int | param, | |||
uint8 * | texture | |||
) |
glTexImage2D replacement.
There are some differences: 1) sizeX and sizeY parameter specifies the texture size IN PIXELS, unlike in libnds. If their size is not a power of two:
void ulTexParameter | ( | uint8 | sizeX, | |
uint8 | sizeY, | |||
uint32 * | addr, | |||
uint8 | mode, | |||
uint32 | param | |||
) |
glTexParameter replacement.
int ulGetTexParameter | ( | ) | [inline] |
glGetTexParameter replacement.
int ulGenTextures | ( | int | n, | |
int * | names | |||
) |
glGenTextures replacement.
void ulBindTexture | ( | int | target, | |
int | name | |||
) |
glBindTexture replacement.
void ulFreeTextures | ( | int | n, | |
int * | names | |||
) |
Frees a list of textures created with ulGenTextures and ulTexImage2D.
int uluTexLoadPal | ( | u16 * | pal, | |
u16 | count, | |||
uint8 | format | |||
) |
gluTexLoadPal replacement, with NULL parameter check for pal.
void uluTexUnloadPal | ( | u32 | addr | ) |
glTexUnloadPal replacement.
void ulBindTextureToGl | ( | int | target, | |
int | name | |||
) |
Binds a texture so that you can use it with the standard VideoGL API.
This is an awful hack, and will REPLACE the currently active texture in VideoGL. You should not use both systems at once, this hack is only designed so that you can select a texture and use VideoGL commands that rely on the active texture.
void ulSetTexAlphaMask | ( | int | enable | ) | [inline] |
void ulChangeVramAllocation | ( | UL_BANKS | banks, | |
UL_BANK_TYPE | type | |||
) |
Changes the current state of one or several VRAM banks. Example (set bank A and B to LCD so you can access it):
void* ulReadTextureToMemory | ( | int | textureID, | |
int | sizeX, | |||
int | sizeY, | |||
int | type | |||
) |
Internal, do not use.
void* ulReadPaletteToMemory | ( | int | paletteID, | |
int | palCount | |||
) |
Internal, do not use.
int ulGetTexVramAvailMemory | ( | ) |
Returns the number of bytes available in texture memory.
int ulGetTexVramUsedMemory | ( | ) |
Returns the number of bytes used in texture memory.
int ulGetTexVramTotalMemory | ( | ) |
Returns the total number of bytes of texture memory (used + remaining).
int ulGetTexPalAvailMemory | ( | ) |
Returns the number of bytes available in texture palette memory.
int ulGetTexPalUsedMemory | ( | ) |
Returns the number of bytes used in texture palette memory.
int ulGetTexPalTotalMemory | ( | ) |
Returns the total number of bytes of texture palette memory (used + remaining).
int ulGetVertexAvailMemory | ( | ) | [inline] |
Returns the number of vertices available in the vertex memory (internal to the GPU).
Each vertex counts as 1 unit, so a quad will take 4 vertices in memory, and a triangle 3 vertices.
When the vertex memory is full, it will no more be possible to draw anything with µLibrary, so this is something very useful to watch!
int ulGetVertexUsedMemory | ( | ) | [inline] |
Returns the number of vertex already stored since the render has started.
int ulGetVertexTotalMemory | ( | ) | [inline] |
Returns the total number of vertices possible in the vertex memory.
Allows to optimize the image sizes to use less memory. Enabled by default.
Fills textures with zeroes when creating them. See UL_TEXINITZERO for more information.