Ninja Library - Texture Function

njReLoadTextureNum

Reloads textures

FORMAT

Sint32 njReLoadTextureNum( n, *texaddr, attr, lod )
Uint32 n
void *texaddr
Uint32 attr
Uint32 lod

PARAMETER

 n  Texture number of the current texture list 
 *texaddr  Address for either a filename or a texture memory 
 attr  Texture attribute 
 lod  Mipmap level 

RETURN

 1  Successful 
 -1  Failure 

DESCRIPTION

Reloads texture to the texture number n of the current texture list.

Textures that can be reloaded must be the same format and size as previously loaded. When loading textures from a file, specify NJD_TEXATTR_TYPE_FILE for attr. When loading textures from a memory, specify NJD_TEXATTR_TYPE_MEMORY for attr.

Also, for mipmap textures, specifying lod allows reloading corresponding mipmap level. For example, setting 128 to lod will reload only 128x128 level mipmap textures.

Specifying 0 to lod will reload all levels of mipmap textures.

When loading from memory, it reloads from the address specified by texaddr to the level specified by lod.


EXAMPLE

Suppose
256x256 mipmap is loaded as texture #0 in the current texture list,
128x128 mipmap is loaded as texture #1 in the current texture list,
256x128 rectangle texture is loaded as texture #2 in the current texture list.
Sint8* texbuf;
texbuf = syMalloc(0x2B000);
/* When reloading from file, texture buffer is needed */
njInitTextureBuffer(texbuf,0x2B000);
/*
 Change texture #0 texture, mipmap level 128x128 to file1.pvr.
 (Here, file1.pvr is 256x256 mipmap texture.)
*/
njReLoadTextureNum(0,"file1.pvr",NJD_TEXATTR_TYPE_FILE,128);
/*
 Reloads all the textures of texture #1.
 (Here, file2.pvr is 128x128 mipmap texture.)
*/
njReLoadTextureNum(1,"file2.pvr",NJD_TEXATTR_TYPE_FILE,0);
/*
 Reloads all the textures of texture #2.
 (Here file3.pvr is 256x128 rectangle texture.)
*/
njReLoadTextureNum(2,"file3.pvr",NJD_TEXATTR_TYPE_FILE,0);
syFree(texbuf);

NOTE

For memory texture, the beginning of texture target (specified by lod) must be specified . Refer to texture document for more details.

REFERENCE

njLoadTextureNum()
njReLoadTextureNumG()

njReLoadTextureNum
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999