##### Ninja Library - Texture Function

# njLoadCacheTextureNum

Loads a texture by texture number

### FORMAT

`

  Sint32 njLoadCacheTextureNum( n )
  Uint32 n

`

### PARAMETER

  `n` | Texture number in current texture list

### RETURN

  1 | Successful |
  -1 | Failed |

### DESCRIPTION

  Loads a texture by texture number n from cache memory to texture memory.

### EXAMPLE

      NJS_TEXNAME texname[2];
      NJS_TEXLIST texlist ={texname,2};
      /* Prepare to read in two textures  */
      NJS_TEXMEMLIST texmemlist[2];
      Sint8 *texbuf;
      Sint8 *cachebuf;
      njInitTexture(texmemlist,2);
      texbuf = syMalloc(0x20800);
      njInitTextureBuffer(texbuf,0x20000);
      /* Set cache buffer 256x256x2bytex2=0x40000*/
      cachebuf = syMalloc(0x40000);
      njInitCacheTextureBuffer(cachebuf,0x40000);
      /* Specify to read file into cache */
      njSetTextureName(&texname[0],"file1.pvr",0,NJD_TEXATTR_TYPE_FILE|
          NJD_TEXTURE_CACHE|NJD_TEXATTR_GLOBALINDEX);
      /* Specify to read file into cache */
      njSetTextureName(&texname[1],"file2.pvr",1,NJD_TEXATTR_TYPE_FILE|
          NJD_TEXTURE_CACHE|NJD_TEXATTR_GLOBALINDEX);
      /* Load texture into cache */
      njLoadTexture(&texlist);
      syFree(texbuf);
      /* Set texlist as the current texture list */
      njSetTexture(&texlist);
      /* Read textures from cache into texture memory*/
      njLoadCacheTextureNum(0);
      njLoadCacheTextureNum(1);
      /* Set current texture as texture #0 in texlist file1.pvr*/
      njSetTextureNum(0);
          :
      /* lit. Drawing texture with texture in file1.pvr */
          :

### NOTE

  Current texture list must be specified by `njSetTexture()` function. The specified texture must be loaded into cache memory. For details, refer to texture document.

### REFERENCE

  `njInitCacheTextureBuffer()
  njLoadCacheTexture()
  njLoadCacheTextureNumG()
  `

njLoadCacheTextureNum

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999