N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## gSPTexture

Syntax

    #include <ultra64.h> /* gbi.h */
    gSPTexture(Gfx *gdl, s32 sc, s32 tc, s32 level, s32 tile, s32 on)
    gsSPTexture(s32 sc, s32 tc, s32 level, s32 tile, s32 on)

Arguments

- gdl is the display list pointer.

- sc is the scaling value for the texture's s coordinate (16-bit precision, .16).

- tc is the scaling value for the texture's t coordinate (16-bit precision, .16).

- level is one less than the maximum number of MIP-map levels (max - 1).

- tile is the tile descriptor index (3-bit precision, 0~7).

- on Texture flag:
  G_ON (Texture ON).
  G_OFF ((Texture OFF).

Explanation
gSPTexture enables/disables textures and sets the scaling value for texturing in the RSP. The texture coordinates are computed by the RSP using the following formula:

(Displayed texture coordinates) = (Scale value) x (Shifted texture coordinate values (see Note))

Note: These are the values of the texture coordinates obtained from the Vtx structure after they have been shifted by the "shift" parameter set in the texture tile attributes.

For details, please see Section 11.5, "Texture State" and Section 11.7.4.3, "Texture Coordinate Transformations" in the N64 Online Programming Manual.

The texture coordinates are created based on the scaling arguments (sc, tc) and the s,t coordinates of the object. Since these are combined by the application, the final s,t values are values in s10.5 format. If you want to scale proportionally, specify 0.5 (0x8000) for sc and tc and double the object's s,t coordinates.

When MIP-mapping, specify for tile the lowest value in the tile sequence being used. This becomes the tile number of the most-detailed map. For example, in the tile sequence n, n+1, n+2, ... the "n" tile will be the most-detailed tile, so "n" is the value set in this macro. The tiles n+1, n+2, ... have diminishing resolution.

For details about tile descriptors, see gDPSetTile and Section 13.5, "Tile Descriptor Loading" in the N64 Programming Manual.

Note
For the on argument, set either G_ON or G_OFF. When this argument is set to G_OFF, the other arguments are not updated. This might be the cause of bugs in the display list when the state of the texture engine is obtained later.

Example
Please refer to Section 11.7.4.3, "Texture Coordinate Transformations" in the N64 Online Programming Manual.

See also
gDPSetTextureImage

Revision History
2/1/1999 Completely rewritten.

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999