GXInitTexObj

Syntax

#include <revolution/gx.h>

void GXInitTexObj(
    GXTexObj*      obj,
    void*          image_ptr,
    u16            width,
    u16            height,
    GXTexFmt       format,
    GXTexWrapMode  wrap_s,
    GXTexWrapMode  wrap_t,
    GXBool         mipmap );

Arguments

obj Pointer to a texture object.
image_ptr Pointer to the image data for a texture. 32-byte aligned.
width Width of the texture or LOD 0 for mipmaps. Maximum value is 1024. For mipmaps, or when GX_REPEAT or GX_MIRROR is the wrap mode for wrap_s, width must be a power of two.
height Height of the texture or LOD 0 for mipmaps. Maximum value is 1024. For mipmaps, or when GX_REPEAT or GX_MIRROR is the wrap mode for wrap_t, height must be a power of two.
format The texel format. Accepted values are:
Name Texture Format
GX_TF_I4 4-bit intensity
GX_TF_IA4 4-bit intensity + 4-bit alpha
GX_TF_I8 8-bit intensity
GX_TF_IA8 8-bit intensity + 8-bit alpha
GX_TF_RGB565 16-bit color (RGB565)
GX_TF_RGB5A3 16-bit color + alpha (RGB555 or RGBA4443)
GX_TF_RGBA8 32-bit full RGBA (8 bits each)
GX_TF_CMPRl Compressed format (4 bits/texel)
GX_TF_Z8 Z texture 8bit (see GXSetZTexture for details)
GX_TF_Z16 Z texture 16bit (see GXSetZTexture for details)
GX_TF_Z24X8 Z texture 24bit (see GXSetZTexture for details)
wrap_s Describes how texture coordinates will be wrapped in the S direction. Accepted values are:
Name Wrap Mode
GX_CLAMP Clamping within the bounds of the image
GX_REPEAT Simple repeating
GX_MIRROR Repeating with mirroring
wrap_t Describes how texture coordinates will be wrapped in the T direction. Accepted values are:
Name Wrap Mode
GX_CLAMP Clamping within the bounds of the image
GX_REPEAT Simple repeating
GX_MIRROR Repeating with mirroring
mipmap When mipmap = GX_TRUE, the texture is a mipmap and will have trilinear filtering; if not GX_TRUE, it is not a mipmap and will use bilinear filtering.

Return Values

None.

Description

This function is used to initialize or change a texture object for non-color index textures. Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. The application must provide memory for texture objects. Once initialized, a texture object can be associated with one of eight active IDs using the GXLoadTexObj function.

To initialize a texture object for color index format textures, use the GXInitTexObjCI function.

If the mipmap flag is GX_TRUE, then the texture is a mipmap and will be trilinear interpolated. If the mipmap flag is GX_FALSE, the texture is not a mipmap and will be bilinear interpolated. To override the filter modes, or use other mipmap controls, call the GXInitTexObjLOD function after GXInitTexObj. Mipmap textures should set the width and height to a power of two, but mipmaps do not need to be square.

See Also

GXInitTexObjCI, GXInitTexObjLOD, GXLoadTexObj, GXTexObj Initialization Flow

Revision History

2006/03/01 Initial version.


CONFIDENTIAL