##### Ninja Library - Texture Function

# njSetTextureName

Sets data into texture name structure

### FORMAT

`

  void njSetTextureName( *texname, *addr, globalIndex, attr )
  NJS_TEXNAME *texname
  void *addr
  Uint32 globalIndex
  Uint32 attr

`

### PARAMETER

  `*texname` | Pointer to NJS_TEXNAME structure
  `*addr` | Pointer to file name or NJS_TEXINFO structure
  `globalIndex` | Global index
  `attr` | Texture attribute

### RETURN

  None

### DESCRIPTION

  Sets filename to addr when loading textures from a file. NJD_TEXATTR_TYPE_FILE should be specified to attr. With PVR format textures, if global index is not used for the textures, set NJD_TEXATTR_GLOBALINDEX to attr and global index to globalIndex. For memory texture, set NJS_TEXINFO structure pointer that is set by `njSetTextureInfo()` to addr. Also, set NJD_TEXATTR_TYPE_MEMORY to attr, and global index to globalIndex.

### EXAMPLE

      NJS_TEXNAME texname[2];
      NJS_TEXLIST texlist ={texname,2};
      /* Prepare to read two textures */
      NJS_TEXMEMLIST texmemlist[2];
      Sint8 *texbuf;
      njInitTexture(texmemlist,2);
      texbuf = syMalloc(0x20800);
      njInitTextureBuffer(texbuf,0x20000);
      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 */
      /* No problem to execute before njLoadTexture() function */
      njSetTexture(&texlist);
      /* Set texture 0 from texlist as current texture file1.pvr */
      njSetTextureNum(0);
          :
      /* lit. Drawing texture with texture of file1.pvr */
          :

### NOTE

  The global index set here is once stored to texaddr in NJS_TEXNAME structure and passed to NJS_MEMLIST structure globalIndex when loading textures. At that time texaddr is overwritten. So you will need to set it again if you load textures, release them and reload them. Refer to texture document for more details.

### REFERENCE

  `njSetTextureInfo()
  `

njSetTextureName

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999