gSPTexture

gSPTexture Macro

Function

gSPTexture Macro

Enables/disables textures and sets scale and primitive tile settings

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
the display list pointer.
sc
the scaling value for the texture's s coordinate (16-bit precision, .16).
tc
the scaling value for the texture's t coordinate (16-bit precision, .16).
level
one less than the maximum number of MIP-map levels (max - 1).
tile
the tile descriptor index (3-bit precision, 0~7).
on
Texture flag:
G_ON (Texture ON).
G_OFF (Texture OFF).

Description

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 (*))

(*) 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

02/01/99 Entirely revised.