1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META http-equiv="Content-Style-Type" content="text/css">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<TITLE>GDSetTexImgPtr, etc.</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GDSetTexImgPtr, etc.</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gd.h&gt;
16
17void GDSetTexImgPtr    ( <A href="../gx/Enumerated_Types/GXTexMapID.html">GXTexMapID</A> id, void *image_ptr );
18void GDSetTexImgPtrRaw ( <A href="../gx/Enumerated_Types/GXTexMapID.html">GXTexMapID</A> id, u32 image_ptr_raw );
19void GDPatchTexImgPtr  ( void *image_ptr );
20</pre></dd></dl>
21
22<H2>Arguments</H2>
23<TABLE class="arguments" border="1" >
24  <TBODY>
25    <TR>
26<TH>id</TH>
27<TD>The hardware texture map <a href="../gx/Enumerated_Types/GXTexMapID.html">ID</a> to change.</TD>
28    </TR>
29    <TR>
30<TH><STRONG><EM><CODE>image_ptr</CODE></EM></STRONG></TH>
31<TD>A pointer to the texture data in Wii main memory. This pointer will be converted from a cached to a physical pointer.</TD>
32    </TR>
33    <TR>
34<TH><STRONG><EM><CODE>image_ptr_raw</CODE></EM></STRONG></TH>
35<TD>A U24 value to be inserted in place of actual base pointer, <SPAN class="argument">image_ptr</SPAN>. This value will be inserted unchanged into the command output.</TD>
36    </TR>
37  </TBODY>
38</TABLE>
39
40<H2>Return Values</H2>
41<P>None.</P>
42
43<H2>Description</H2>
44<P><code>GDSetTexImgPtr</code> function is used to set the image pointer for a specified hardware texture map ID.&nbsp;Unlike the GX library, which uses texture objects, GD libraries set the hardware registers directly.</P>
45<P><CODE>GDSetTexImgPtr</CODE> function takes a Wii main memory pointer as an argument. This function is used for writes to the display list. Because the desired address is unknown when the display list is created, additional functions are available to simplify patching the display list.&nbsp;</P>
46<P>The <CODE>GDSetTexImgPtrRaw</CODE> function allows a raw (U24) data value to be written in place of the texture data pointer. The <code>GDSetTexImgPtr</code> function converts the logical address into a physical address.&nbsp;The raw version of the function omits this process.</P>
47<P><code>GDPatchTexImgPtr</code> function writes out a converted address only.&nbsp;To properly use this function, you must first save the correct patch location (when the display list was created), and then reset the current offset to this patch location before calling <code>GDPatchTexImgPtr</code>. Finally, the newly written data is flushed back into main memory. The following code illustrates the correct operation sequence.</P>
48<P>Display list creation:</P>
49<dl><dd><pre class="construction">
50savedOffset[0] = GDGetCurrOffset() + BP_DATA_OFFSET;  // save the necessary offset
51GDSetTexImgPtrRaw( GX_TEXMAP0, 0 );
52</pre></dd></dl>
53<P>Display list patching:</P>
54<dl><dd><pre class="construction">
55GDSetCurrOffset(savedOffset[0]);  // set the offset
56cp = GDGetCurrPointer();          // save ptr for flushing later
57GDPatchTexImgPtr(tp);             // patch in the base address ptr
58DCStoreRange(cp, BP_DATA_LENGTH); // flush to main memory
59</pre></dd></dl>
60<P>Because the <CODE>GDSetTexImgPtr</CODE> function issues a BP command, <CODE>BP_DATA_OFFSET</CODE> and <CODE>BP_DATA_LENGTH</CODE> are used in the above code segments.</P>
61
62<H2>See Also</H2>
63<P class="reference">
64<A href="../gx/Texture/GXInitTexObj.html">GXInitTexObj</A>,
65<A href="GDSetTexLookupMode.html">GDSetTexLookupMode</A>,
66<A href="GDSetTexImgAttr.html">GDSetTexImgAttr</A>
67</P>
68
69<H2>Revision History</H2>
70<P>
712006/03/01 Initial version.<BR>
72</P>
73
74<hr><p>CONFIDENTIAL</p></body>
75</HTML>