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

## gSPObjRenderMode [macro]

Changes the object rendering mode in the RSP.

Syntax

    #include <ultra64.h> /* gs2dex.h */
    gSPObjRenderMode(Gfx *gdl, u32 mode)
    gsSPObjRenderMode(u32 mode)

Arguments

- gdl is the pointer to the graphics display list.

- mode is the object rendering mode:
  G_OBJRM_NOTXCLAMP (Do not perform clamping)
  G_OBJRM_BILERP (Correct when bilinear interpolation is performed)
  G_OBJRM_SHRINKSIZE_1 (Trim 0.5 texel off drawn image)
  G_OBJRM_SHRINKSIZE_2 (Trim 1.0 texel off drawn image)
  G_OBJRM_WIDEN (Enlarge drawn image by 3/8 texel)

Explanation
Changes the object rendering mode in the RSP. Normally, the object rendering mode is set according to the screen mode. The RDP has various rendering modes for drawing sprites or backgrounds (BG). For information about these object rendering modes, refer to the Readme file of the latest version of the S2DEX microcode.

Multiple modes can be specified for mode with a bit sum of the following flags. However, note that G_OBJRM_SHRINKSIZE_1 and G_OBJRM_SHRINKSIZE2 cannot be specified at the same time.

G_OBJRM_NOTXCLAMP

Specifies that no clamping be performed in the RSP. When a texture is fixed to a sprite, the following relationships hold for the texture size (imageW, imageH), scale values (scaleW, scaleH) and sprite size (objW, objH)
  objW = imageW / scaleW;
  objH = imageH / scaleH;
When the texture is fixed to the sprite, the region of the texture from texture coordinates (0, 0) to (imageW-1, imageH-1) is drawn on the sprite. However, due to calculation errors, a little texture outside of this range may be displayed at the periphery of the sprite. To prevent this, the RSP performs clamping outside of the range where the texture is to be drawn. For information about clamping, see Section 13 "Texture Mapping" in the N64 Programming Manual.

G_OBJRM_BILERP
  Corrects for the 0.5 slippage of the texture that occurs when bilinear interpolation is performed. When clamping is turned on, the RSP uses the bilinear interpolation feature and supports subpixel-unit movements of the internal images. This enables a sprite to be moved in 1/4-pixel units.

G_OBJRM_SHRINKSIZE_1
  Draws texture image for which the perimeter has been pared down by 0.5 texel. When a number of bilinearly interpolated sprites are to be aligned and handled as one large bilinearly interpolated sprite, the continuity of the image at the boundaries becomes a problem. To ensure image continuity, you must overlap the textures of the individual sprites by one line each. This makes the 0.5 texel at the periphery (the colored portion in the figure below) unnecessary because the neighboring sprite takes care of this part. Although each texture image is reduced in size by 0.5 texel, the upper-left screen coordinate does not change, and the drawing result will be as shown in the figure below.

G_OBJRM_SHRINKSIZE_2
  This mode works the same as G_OBJRM_SHRINKSIZE_1, but doubles the scale of image reduction (pares 1 texel around the periphery). It is used when the texels of adjacent sprites are overlapped by two lines each to maintain continuity when subpixel processing is performed.

G_OBJRM_WIDEN
  Enlarges the drawn image by 3/8 pixel in the positive S and T directions. This mode is used to prevent blank space from opening up at the seams when a large rotating object is displayed from texture memory (TMEM) by combining sprites. This mode is effective when combining and drawing opaque sprites. It is unnecessary for translucent sprites because the seams are filled by processing by the blender (BL).

Cautions
When drawing sprites, use the following RDP rendering modes:

When antialiasing is off:

<Opaque sprites>

  G_RM_SPRITE
  G_RM_SPRITE2
<Translucent sprites>
  G_RM_XLU_SPRITE
  G_RM_XLU_SPRITE2

When antialiasing is on:

<Opaque sprites>

  G_RM_AA_SPRITE/G_RM_RA_SPRITE
  G_RM_AA_SPRITE2/G_RM_RA_SPRITE2
<Translucent sprites>
  G_RM_AA_XLU_SPRITE
  G_RM_AA_XLU_SPRITE2

When two sprites overlap, the edge of the bottom sprite may affect the edge of the top sprite. Since this cannot be avoided, use G_RM_XLU_SPRITE if this bothers you.

See Also
gDPSetRenderMode

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-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999