##### Ninja Library - Texture Function

# njLoadTexture

Loads a texture

### FORMAT

`

  Sint32 njLoadTexture( *texlist )
  NJS_TEXLIST *texlist

`

### PARAMETER

  `*texlist` | pointer to NJS_TEXLIST structure

### RETURN

  1 | Successful |
  -1 | Failed |

### DESCRIPTION

  Loads the texture set into the texlist structure into texture memory or cache memory.

  Specify member "textures" which indicates the pointer to NJS_TEXLIST structure setting each texture information and member " nbTexture" which indicates number of textures.

  Texture information needs to be set in NJS_TEXNAME structure for numbers of required texture.

  For details, refer to texture document.

### EXAMPLE

      NJS_TEXNAME texname[2];
      NJS_TEXLIST texlist ={texname,2};
      /* Prepare to read in two textures */
      NJS_TEXMEMLIST texmemlist[2];
      Sint8 *texbuf;
      njInitTexture(texmemlist,2);
      texbuf = syMalloc(0x20800);
      njInitTextureBuffer(texbuf,0x20000);
      /* Set the two textures */
      njSetTextureName(&texname[0],"file1.pvr",0,NJD_TEXATTR_TYPE_FILE|
             NJD_TEXATTR_GLOBALINDEX);
      njSetTextureName(&texname[1],"file2.pvr",1,NJD_TEXATTR_TYPE_FILE|
             NJD_TEXATTR_GLOBALINDEX);
      /* Load texture */
      njLoadTexture(&texlist);
      syFree(texbuf);
      /* Set texlist as the current texture list */
      njSetTexture(&texlist);
      /* Set current texture to texlist #0 */
      njSetTextureNum(0);

### NOTE

  `njInitTexture()` function must be executed prior to executing this function. The texture buffer must be set by `njInitTextureBuffer()` function if loaded from file. For details, refer to texture document.

### REFERENCE

  `njInitTextureBuffer()
  njInitTexture()
  njLoadTextureNum()
  njLoadTextureReq()
  `

njLoadTexture

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999