GXInitTexObj

C Specification

#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
The maximum value is 1024. For mipmaps, or when GX_REPEAT/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
The maximum value is 1024. For mipmaps, or when GX_REPEAT/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 8-bit Z texture (see GXSetZTexture for details)
GX_TF_Z16 16-bit Z texture (see GXSetZTexture for details)
GX_TF_Z24X8 24-bit Z texture (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; otherwise, 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 GXInitTexObjCI.

If the mipmap flag is GX_TRUE, then the texture is a mipmap and the texture will be trilerped. If the mipmap flag is GX_FALSE, the texture is not a mipmap and the texture will be bilerped. To override the filter modes and other mipmap controls, call GXInitTexObjLOD 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

03/01/2006 Initial version.