Chapter 14 - Texture Rectangles (Hardware Sprites)

A texture rectangle is a special primitive supported by the Reality Display Processor (RDP) hardware. This primitive is intended to provide simple "sprite" capabilities with a minimum number of parameters. Texture rectangles are screen-aligned rectangles whose coordinates are defined directly in screen space.

Example 14-1 Texture Rectangle Command
gsSPTextureRectangle(x1,y1,xh,yh,tile,s,t,dsdx,dtdy)
      

Texture coordinates are defined by specifying the start point S and T coordinates at the top left corner of the rectangle and the step in S per pixel in X and the step in T per pixel in Y. Example 14-2 shows a rectangle 100 pixels wide by 100 pixels high drawn at screen coordinates (100,100). The texture coordinates at the top left corner of the rectangle are (0,0). The texture steps 1 texel per pixel in both the S and T directions. This example assumes that a texture has been previously loaded (see Section "13.9, Texture Loading").

Example 14-2 Texture Rectangle Example
gsDPSetTexturePersp(G_TP_NONE),
gsSPTextureRectangle(100<<2,100<<2,200<<2,200<<2,
                G_TX_RENDERTILE,
                0,0,
                1<<10,1<<10),
      

Caution: The perspective divide of the texture coordinates in the RDP must be disabled using the gsDPSetTexturePersp() command when rendering texture rectangles.

Texture rectangles are two-dimensional (2D)-- they may be translated in X and Y, but not rotated. Texture rectangles may be Z buffered in a limited way, as described in Section 14.7, "Z Buffering Texture Rectangles". This chapter will explain some of the details associated with the texture rectangle primitive and provide some simple examples for new Nintendo 64 programmers.

Figure 14-1 Texture Rectangle Definition
[Figure14-1]

14.1 Sampling Overview
14.1.1 Point Sampling
14.1.2 Bilinear Filtering
14.1.3 Average mode for 1:1 Ratio Sampling
14.1.4 Copy
14.2 Simple Texture Effects
14.2.1 Flip
14.2.2 Mirror
14.2.3 Wrap
14.2.4 Sliding Textures
14.2.5 Smooth Scrolling
14.2.6 Billboards
14.2.7 Cloud (CLD) Render Mode
14.3 Texture Types
14.3.1 Intensity (I) Textures
14.3.2 Intensity Alpha (IA) Texture
14.3.3 Color (RGBA) Textures
14.3.4 Color Index (CI) Textures
14.3.5 Combining Types
14.4 Multi-Tile Effects
14.4.1 Simple Morph
14.4.2 Smoothing Flip-Book Animations
14.4.3 Shrinking Sprites
14.4.4 Texture Decals
14.4.5 Interference Effects
14.5 Tiling Large Images
14.6 Color Index Frame Buffer
14.7 Z buffering Texture Rectangles
14.7.1 Primitive Z