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>GXLoadTlut</title>
10</head>
11
12<body>
13
14<h1 align="left">GXLoadTlut</h1>
15
16
17<h2>C Specification</h2>
18
19<dl>
20<dd><PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
21  </dd>
22<dd><pre><CODE>void GXLoadTlut(
23const <a href="../Structures/GXTlutObj.html">GXTlutObj</a><em>*   </em>tlut_obj,
24u32                <a href="../Enumerated_Types/GXTlut.html">tlut_name</a> );</CODE></pre>
25  </dd>
26</dl>
27
28<h2>Arguments</h2>
29<TABLE border="1" cellpadding="3" cellspacing="0.1">
30  <tr>
31<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>tlut_obj</CODE></strong></em></TD>
32<TD width="520">pointer to a <a href="../Structures/GXTlutObj.html"><code><CODE>GXTlutObj</CODE></code></a> structure <BR>The application must allocate the memory for this object.</TD>
33    </tr>
34  <tr>
35<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>tlut_name</CODE></strong></em></TD>
36<TD width="520">name of the texture memory lookup table</TD>
37    </tr>
38</TABLE>
39<h2>Return Values</h2>
40
41<p>None.</p>
42<H2>Description</H2>
43<P>This function copies a texture lookup table (TLUT) from main memory to texture memory (TMEM).&nbsp;The <code>tlut_name</code> argument is the name of a pre-allocated region of TMEM.&nbsp;The callback function set by <a href="GXSetTlutRegionCallback.html"><code>GXSetTlutRegionCallBack</code></a> converts the <code>tlut_name</code> into a pointer to a <a href="../Structures/GXTlutRegion.html"><code>GXTlutRegion</code></a> structure.&nbsp;The TLUT is loaded in the TMEM region described by this pointer. <code>tlut_obj</code> describes the location of the TLUT in main memory, the TLUT format, and the TLUT size. <code>tlut_obj</code> will have been previously initialized with <a href="GXInitTlutObj.html"><code>GXInitTlutObj</code></a>.</P>
44<P><a href="GXLoadTlut.html"><code>GXLoadTlut</code></a> will make an assertion check to make sure the TLUT size described by <code>tlut_obj</code> is less than or equal to the TLUT region size in TMEM described by <code>tlut_name</code>.</P>
45<P><a href="../Management/GXInit.html"><code>GXInit</code></a> sets a default callback to convert <code>tlut_names</code> from <a href="../Enumerated_Types/GXTlut.html"><code>GXTlut</code></a> to pointers to <a href="../Structures/GXTlutRegion.html"><code>GXTlutRegion</code></a> structures.&nbsp;The default configuration of TMEM has 20 TLUTs, sixteen of which are 16-bit 256 entries, and four of which are 16-bit 1K entries.&nbsp;This configuration can be overwritten by calling the <a href="GXInitTlutRegion.html"><code>GXInitTlutRegion</code></a> and <a href="GXInitTexCacheRegion.html"><code>GXInitTexCacheRegion</code></a> functions to allocate TMEM.&nbsp;You can then define your own region allocation scheme using the <a href="GXSetTlutRegionCallback.html"><code>GXSetTlutRegionCallBack</code></a> and <a href="GXSetTexRegionCallback.html"><code>GXSetTexRegionCallBack</code></a> functions.</P>
46<H4>NB:&nbsp;</H4>
47<P>Due to restrictions in the GX library, when calling fonts, they must always be followed with a call to <code><a href="GXLoadTexObj.html">GXLoadTexObj</a></code>.</P>
48<P>Here are two examples:</P>
49<P>1. The <a href="../Structures/GXTexObj.html"><code>GXTexObj</code></a> structure (texel data) for CI textures must be loaded after the TLUT.</P>
50<P><CODE>GXInitTexObjCI(texObj, ..., GX_TLUT0);<BR>GXInitTlutObj(tlut, ...);<BR>&nbsp;&nbsp;&nbsp; :<BR>GXLoadTlut(tlut, GX_TLUT0); //<BR> GXLoadTexObj(texObj, ...);&nbsp; // Always keep this order.</CODE></P>
51<P>2. If the TLUT portion of the CI texture is updated with <code>GXLoadTlut</code>, the texel data portion must be reloaded with the <code><a href="GXLoadTexObj.html">GXLoadTexObj</a></code> structure.</P>
52<P><CODE>GXInitTexObjCI(texObj, ..., GX_TLUT0);<BR>GXInitTlutObj(tlutA, ...);<BR>GXInitTlutObj(tlutB, ...);<BR>&nbsp;&nbsp;&nbsp; :<BR>GXLoadTlut(tlutA, GX_TLUT0);<BR>GXLoadTexObj(texObj, ...);<BR>&nbsp;&nbsp;&nbsp; :<BR>GXLoadTlut(tlutB, GX_TLUT0); // Only TLUT is going to be updated.<BR> GXLoadTexObj(texObj, ...);&nbsp;&nbsp; // Must reload texobj.<BR></CODE></P>
53<P>There is an insignificant performance penalty for the extra <a href="GXLoadTexObj.html"><code>GXLoadTexObj</code></a> call because <a href="GXLoadTexObj.html"><code>GXLoadTexObj</code></a> won't actually load the entire texture into TMEM, but will only load the settings.</P>
54
55<h2>See Also</h2>
56
57<p><a href="GXInitTlutObj.html"><CODE>GXInitTlutObj</CODE></a><br> <a href="GXInitTlutRegion.html"><CODE>GXInitTlutRegion</CODE></a><br> <a href="GXSetTlutRegionCallback.html"><CODE>GXSetTlutRegionCallBack</CODE></a></p>
58<H2>Revision History</H2>
59<P>03/01/2006 Initial version.</P>
60</BODY>
61</HTML>