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=utf-8">
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 &lt;revolution/gx.h&gt;
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++ &amp; 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><BR> <a href="GXLoadTexObj.html">GXLoadTexObj</a><BR><a href="GXSetTlutRegionCallback.html">GXSetTlutRegionCallback</a><BR> <a href="GXTMEMDefault.html">GX Default TMEM Configuration</a>
43</p>
44
45<H2>Revision History</H2>
46<P>
472006/03/01 Initial version.<br>
48</P>
49
50<hr><p>CONFIDENTIAL</p></body>
51</HTML>