GXSetTlutRegionCallback

C Specification

#include <revolution/gx.h>

typedef GXTlutRegion *(* GXTlutRegionCallback)( u32 tlut_name );
GXTlutRegionCallback GXSetTlutRegionCallback( GXTlutRegionCallback f );

Arguments

f Pointer to a function that takes the u32 TLUT name as an argument and returns a pointer to GXTlutRegion.

Return Values

This function returns a pointer to the previous callback function.

Description

The function f is called by GXLoadTlut to find the region into which to load the TLUT. GXLoadTexObj will also call f to obtain the texture lookup table (TLUT) region when the texture format is color-index.

For a given tlut_name, f must always return the same GXTlutRegion. This is because GXLoadTlut will initialize data into the GXTlutRegion which GXLoadTexObj will use subsequently.

GXInit calls GXSetTlutRegionCallback to set a default TLUT index-to-region mapping. The name for the TLUT from the texture object is provided as an argument to the callback. The callback should return a pointer to the GXTlutRegion for this TLUT index.

// example of a simple TLUT region lookup
GXTlutRegion *__GXGetTlutRegion(u32 idx)
{
        return(__GXTlutRegionTab[idx]);
}

GXSetTlutRegionCallback( __GXGetTlutRegion ); // GXInit

See Also

GXInit
GXLoadTexObj
GXLoadTlut
GXSetTexRegionCallback

GX Default TMEM Configuration

Revision History

03/01/2006 Initial version.