1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>GXSetTexRegionCallback</title> 10</head> 11 12<body> 13 14<h1 align="left">GXSetTexRegionCallback</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20typedef <a href="../Structures/GXTexRegion.html">GXTexRegion</a> *(* GXTexRegionCallback)(const <a href="../Structures/GXTexObj.html">GXTexObj</a> *t_obj, <a href="../Enumerated_Types/GXTexMapID.html">GXTexMapID</a> id); 21 22GXTexRegionCallback GXSetTexRegionCallback( GXTexRegionCallback f ); 23</pre></dd></dl> 24 25<h2>Arguments</h2> 26<TABLE class="arguments" border="1" > 27 <tr> 28<TH><STRONG><EM><CODE>f</CODE></EM></STRONG></TH> 29<TD>Pointer to a function which takes <A href="../Structures/GXTexObj.html"><CODE>GXTexObj</CODE></A> and <A href="../Enumerated_Types/GXTexMapID.html"><CODE>GXTexMapID</CODE></A> as arguments and returns a pointer to <A href="../Structures/GXTexRegion.html"><CODE>GXTexRegion</CODE></A>.</TD> 30 </tr> 31</TABLE> 32 33<h2>Return Values</h2> 34<P>This function returns a pointer to the previous callback function.</P> 35 36<H2>Description</H2> 37<P>This function, <SPAN class="argument">f</SPAN>, is called by the <A href="GXLoadTexObj.html"><CODE>GXLoadTexObj</CODE></A> function to get an available texture region. The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function calls the <A href="GXSetTexRegionCallback.html"><CODE>GXSetTexRegionCallback</CODE></A> function to set a default region-allocation policy. The programmer can override this default region allocation by implementing their own callback function. A pointer to the texture object and the texture map ID that are passed to <a href="GXLoadTexObj.html"><code>GXLoadTexObj</code></a> are provided to the callback function.</P> 38<BLOCKQUOTE><code>// example of simple texture region allocator<br> GXTexRegion *__GXGetTexRegion(const GXTexObj *tex_obj, GXTexMapID id)<br> {<br> #pragma unused(id)<br> static u32 i = 0;<br> return(__GXTexRegionTab[i++ & 0x0007]);<br> }<br> <br> GXSetTexRegionCallback( __GXGetTexRegion ); // GXInit</code></BLOCKQUOTE> 39 40<h2>See Also</h2> 41<P class="reference"> 42<a href="../Management/GXInit.html">GXInit</a>, 43<a href="GXLoadTexObj.html">GXLoadTexObj</a>, 44<a href="GXSetTlutRegionCallback.html">GXSetTlutRegionCallback</a>, 45<a href="GXTMEMDefault.html">GX Default TMEM Configuration</a> 46</p> 47 48<H2>Revision History</H2> 49<P> 502006/03/01 Initial version.<br> 51</P> 52 53<hr><p>CONFIDENTIAL</p></body> 54</HTML>