GXSetTexRegionCallback

C Specification

#include <revolution/gx.h>

typedef GXTexRegion *(* GXTexRegionCallback)(const GXTexObj *t_obj, GXTexMapID id);
GXTexRegionCallback GXSetTexRegionCallback( GXTexRegionCallback f );

Arguments

f Pointer to a function which takes GXTexObj and GXTexMapID as arguments and returns a pointer to GXTexRegion.

Return Values

This function returns a pointer to the previous callback function.

Description

The function f is called by GXLoadTexObj to obtain an available texture region. GXInit calls GXSetTexRegionCallback to set a default region-assignment policy. A programmer can override this default region assignment by implementing his own callback function. A pointer to the texture object and the texture map ID that are passed to GXLoadTexObj are provided to the callback function.

// example of simple texture region allocator
GXTexRegion *__GXGetTexRegion(const GXTexObj *tex_obj, GXTexMapID id)
{
#pragma unused(id)
    static u32 i = 0;
    return(__GXTexRegionTab[i++ & 0x0007]);
}

GXSetTexRegionCallback( __GXGetTexRegion ); // GXInit

See Also

GXInit
GXLoadTexObj
GXSetTlutRegionCallback

GX Default TMEM Configuration

Revision History

03/01/2006 Initial version.