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 17<h2>C Specification</h2> 18 19<dl> 20<dd><pre><CODE>#include <revolution/gx.h> 21 22typedef <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);</CODE></pre> 23 </dd> 24<dd><pre><CODE>GXTexRegionCallback GXSetTexRegionCallback( GXTexRegionCallback f ); 25</CODE></pre> 26 </dd> 27</dl> 28 29<h2>Arguments</h2> 30<TABLE border="1" cellpadding="3" cellspacing="0.1"> 31 <tr> 32<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>f</CODE></strong></em></TD> 33<TD width="520">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> 34 </tr> 35</TABLE> 36<h2>Return Values</h2> 37 38<P>This function returns a pointer to the previous callback function.</P> 39<H2>Description</H2> 40<P>The function <code><em><strong>f</strong></em></code> is called by <a href="GXLoadTexObj.html"><code>GXLoadTexObj</code></a> to obtain an available texture region. <a href="../Management/GXInit.html"><code>GXInit</code></a> calls <a href="GXSetTexRegionCallback.html"><code>GXSetTexRegionCallback</code></a> 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 <a href="GXLoadTexObj.html"><code>GXLoadTexObj</code></a> are provided to the callback function.</P> 41<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> 42 43<h2>See Also</h2> 44 45<p><a href="../Management/GXInit.html">GXInit</a><br> <a href="GXLoadTexObj.html">GXLoadTexObj</a><br> <a href="GXSetTlutRegionCallback.html">GXSetTlutRegionCallback</a></p> 46<p><a href="GXTMEMDefault.html">GX Default TMEM Configuration</a></p> 47<H2>Revision History</H2> 48<P>03/01/2006 Initial version.</P> 49</BODY> 50</HTML>