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<H2>C Specification</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <revolution/gd.h></CODE></PRE> 16 <DD> 17 <PRE><CODE>void 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 );</CODE></PRE> 20</DL> 21<H2>Arguments</H2> 22<TABLE border="1" cellpadding="3" cellspacing="0.1"> 23 <TBODY> 24 <TR> 25<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>id</CODE></STRONG></EM></TD> 26<TD width="520">The hardware texture map <a href="../gx/Enumerated_Types/GXTexMapID.html">ID</a> to change.</TD> 27 </TR> 28 <TR> 29<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>image_ptr</CODE></STRONG></EM></TD> 30<TD width="520">A pointer to the texture data in Revolution main memory. This pointer will be converted from a cached to a physical pointer.</TD> 31 </TR> 32 <TR> 33<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>image_ptr_raw</CODE></EM></STRONG></CODE></STRONG></EM></TD> 34<TD width="520">A U24 value to be inserted in place of <STRONG><EM><CODE>image_ptr</CODE></EM></STRONG>. This value will be inserted unchanged into the command output.</TD> 35 </TR> 36 </TBODY> 37</TABLE> 38<H2>Return Values</H2> 39<P>None.</P> 40<H2>Description</H2> 41<P><code>GDSetTexImgPtr</code> is used to set the image pointer for a specified hardware texture map ID. Unlike the GX library, which uses texture objects, GD functions set the hardware registers directly.</P> 42<P><code>GDSetTexImgPtr</code> takes a Revolution main memory pointer as an argument. This function is used to write 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. </P> 43<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. The raw version of the function omits this process.</P> 44<P><code>GDPatchTexImgPtr</code> writes out a converted address only. 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> 45<P>Display list creation:</P> 46<BLOCKQUOTE> 47<PRE>savedOffset[0] = GDGetCurrOffset() + BP_DATA_OFFSET; // save the necessary offset 48GDSetTexImgPtrRaw( GX_TEXMAP0, 0 );</PRE> 49</BLOCKQUOTE> 50<P>Display list patching:</P> 51<BLOCKQUOTE> 52<PRE>GDSetCurrOffset(savedOffset[0]); // set the offset 53cp = GDGetCurrPointer(); // save ptr for flushing later 54GDPatchTexImgPtr(tp); // patch in the base address ptr 55DCStoreRange(cp, BP_DATA_LENGTH); // flush to main memory</PRE> 56</BLOCKQUOTE> 57<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> 58<H2>See Also</H2> 59<P><A href="../gx/Texture/GXInitTexObj.html"><CODE>GXInitTexObj</CODE></A><BR> <BR> <A href="GDSetTexLookupMode.html"><CODE>GDSetTexLookupMode</CODE></A><BR> <A href="GDSetTexImgAttr.html"><CODE>GDSetTexImgAttr</CODE></A></P> 60<H2>Revision History</H2> 61<P>2006/03/01 Initial version.</P> 62<hr> 63<P>CONFIDENTIAL</p> 64</BODY> 65</HTML>