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 name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>GXInitTexObjCI</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXInitTexObjCI</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17void GXInitTexObjCI( 18 <A href="../Structures/GXTexObj.html">GXTexObj</A>* obj, 19 void* image_ptr, 20 u16 width, 21 u16 height, 22 <A href="../Enumerated_Types/GXCITexFmt.html">GXCITexFmt</A> format, 23 <A href="../Enumerated_Types/GXTexWrapMode.html">GXTexWrapMode</A> wrap_s, 24 <A href="../Enumerated_Types/GXTexWrapMode.html">GXTexWrapMode</A> wrap_t, 25 <A href="../Enumerated_Types/GXBool.html">GXBool</A> mipmap, 26 u32 tlut_name); 27</pre></dd></dl> 28 29<H2>Arguments</H2> 30<TABLE class="arguments" border="1" > 31 <TBODY> 32 <TR> 33<TH><em><strong><code>obj</code></strong></em></TH> 34<TD>Pointer to a texture object.</TD> 35 </TR> 36 <TR> 37<TH><STRONG><EM><CODE>image_ptr</CODE></EM></STRONG></TH> 38<TD>Pointer to the image data for a texture 32-byte aligned.</TD> 39 </TR> 40 <TR> 41<TH><CODE>width</CODE></TH> 42<TD>Width of the texture or LOD 0 for mipmaps. Maximum value is 1024. Mipmaps must be a power of two. If <code>GX_REPEAT</code> or <code>GX_MIRROR</code> is set for <SPAN class="argument">wrap_s</SPAN>, the width must be a power of two.</TD> 43 </TR> 44 <TR> 45<TH><CODE>height</CODE></TH> 46<TD>Height of the texture or LOD 0 for mipmaps. Maximum value is 1024. Mipmaps must be a power of two. If <code>GX_REPEAT</code> or <code>GX_MIRROR</code> is set for <SPAN class="argument">wrap_t</SPAN>, the height must be a power of two.</TD> 47 </TR> 48 <TR> 49<TH><CODE>format</CODE></TH> 50<TD>The texel <A href="../Enumerated_Types/GXCITexFmt.html">format</A>. Accepted values are:<BR> 51 <TABLE class="arguments" border="1" > 52 <tr> 53<TD bgcolor="#C0C0C0">Name</TD> 54<TD bgcolor="#C0C0C0">Texture Format</TD> 55 </tr> 56 <tr> 57<TH>GX_TF_C4</TH> 58<TD>4-bit color index</TD> 59 </tr> 60 <tr> 61<TH>GX_TF_C8</TH> 62<TD>8-bit color index</TD> 63 </tr> 64 <tr> 65<TH>GX_TF_C14X2</TH> 66<TD>14-bit color index</TD> 67 </tr> 68 </TABLE> 69 </TD> 70 </TR> 71 <TR> 72<TH><STRONG><EM><CODE>wrap_s</CODE></EM></STRONG></TH> 73<TD>Describes how texture coordinates will be wrapped in the S direction. Accepted values are:<BR> 74 <TABLE class="arguments" border="1" > 75 <tr> 76<TD bgcolor="#C0C0C0">Name</TD> 77<TD bgcolor="#C0C0C0">Wrap Mode</TD> 78 </tr> 79 <tr> 80<TH>GX_CLAMP</TH> 81<TD>Clamping within the bounds of the image</TD> 82 </tr> 83 <tr> 84<TH>GX_REPEAT</TH> 85<TD>Simple repeating</TD> 86 </tr> 87 <tr> 88<TH>GX_MIRROR</TH> 89<TD>Repeating with mirroring</TD> 90 </tr> 91 </TABLE> 92 </TD> 93 </TR> 94 <TR> 95<TH><STRONG><EM><CODE>wrap_t</CODE></EM></STRONG></TH> 96<TD>Describes how texture coordinates will be wrapped in the T direction. Accepted values are:<BR> 97 <TABLE class="arguments" border="1" > 98 <tr> 99<TD bgcolor="#C0C0C0">Name</TD> 100<TD bgcolor="#C0C0C0">Wrap Mode</TD> 101 </tr> 102 <tr> 103<TH>GX_CLAMP</TH> 104<TD>Clamping within the bounds of the image</TD> 105 </tr> 106 <tr> 107<TH>GX_REPEAT</TH> 108<TD>Simple repeating</TD> 109 </tr> 110 <tr> 111<TH>GX_MIRROR</TH> 112<TD>Repeating with mirroring</TD> 113 </tr> 114 </TABLE> 115 </TD> 116 </TR> 117 <TR> 118<TH><STRONG><EM><CODE>mipmap</CODE></EM></STRONG></TH> 119<TD>If <SPAN class="argument">mipmap</SPAN> = <CODE>GX_TRUE</CODE>, this is a mipmap texture. Otherwise, this is a 2D texture.</TD> 120 </TR> 121 <TR> 122<TH>tlut_name</TH> 123<TD>texture lookup table name used for this texture The default texture setting takes a name found in <A href="../Enumerated_Types/GXTlut.html"><CODE>GXTlut</CODE></A>.</TD> 124 </TR> 125 </TBODY> 126</TABLE> 127 128<H2>Return Values</H2> 129<P>None.</P> 130 131<H2>Description</H2> 132<P>This function is used to initialize or change texture objects when the texture is in the color index (CI) format. Texture objects are used to describe all the parameters associated with a texture, including size, format, wrap modes, filter modes, etc. The application must provide memory for texture objects. Once initialized, a texture object can be associated with one of eight active IDs using the <A href="GXLoadTexObj.html"><CODE>GXLoadTexObj</CODE></A> function.</P> 133<P>If the <code>mipmap</code> flag is <code>GX_TRUE</code>, the texture is a mipmap and the texture will be filtered using the <code>GX_LIN_MIP_NEAR</code> filter mode (color index mipmaps cannot use the <code>GX_LIN_MIP_LIN</code> or <code>GX_NEAR_MIP_LIN</code> modes). If the <code><em><strong>mipmap</strong></em></code> flag is <code>GX_FALSE</code>, the texture is not a mipmap, and the texture will be bilinear-interpolated. See the <A href="GXInitTexObjLOD.html"><CODE>GXInitTexObjLOD</CODE></A> function for information on overriding the filter modes and other mipmap controls. Mipmaps have a width and height of powers of two, but mipmaps do not need to be square.</P> 134 135 136<P>The width and height of non-mipmapped, 2D textures do not need to be a power of two. However, the dimension involved must be a power of two in order to use the <CODE>GX_REPEAT</CODE> or <CODE>GX_MIRROR</CODE> modes for <SPAN class="argument">wrap_s</SPAN> or <SPAN class="argument">wrap_t</SPAN>.</P> 137<P><SPAN class="argument">tlut_name</SPAN> is used to indicate which texture lookup table (TLUT) to use.</P> 138<P>The default texture pipeline as configured by the <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function uses the names in <A href="../Enumerated_Types/GXTlut.html"><CODE>GXTlut</CODE></A>. Default settings provide thirty-two 256-entry TLUTs. A default callback function is used to convert these names to texture memory addresses when the TLUT or color index texture object is loaded. To make new TLUTs or allocate TLUTs differently, you must:</P> 139<UL> 140<LI>Allocate the <A href="GXInitTlutRegion.html"><CODE>GXTlutRegions</CODE></A> function using the <A href="GXInitTlutRegion.html"><CODE>GXInitTlutRegion</CODE></A> function. 141<LI>Register a callback function to convert the user TLUT name to TLUT addresses in texture memory using the <A href="GXSetTlutRegionCallback.html"><CODE>GXSetTLUTRegionCallBack</CODE></A> function. 142</UL> 143<P>Keep in mind that texture caches, pre-loaded textures and TLUTs share the texture memory. Changes in TLUT allocation should also be accompanied by changes in texture cache and pre-loaded texture allocation.</P> 144 145<H2>See Also</H2> 146<P class="reference"> 147<A href="GXLoadTexObj.html">GXLoadTexObj</A>, 148<A href="GXLoadTlut.html">GXLoadTlut</A>, 149<A href="GXInitTexCacheRegion.html">GXInitTexCacheRegion</A>, 150<A href="GXSetTexRegionCallback.html">GXSetTexRegionCallBack</A>, 151<A href="GXTexObjInitFlow.html">GXTexObj Initialization Flow</A> 152</P> 153 154<H2>Revision History</H2> 155<P> 1562008/05/23 Touched up the text.<br>2006/03/01 Initial version.<br> 157</P> 158 159<hr><p>CONFIDENTIAL</p></body> 160</HTML>