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<H2>C Specification</H2>
13<DL>
14  <DD>
15<PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17<PRE><CODE>void GXInitTexObjCI(
18<A href="../Structures/GXTexObj.html">GXTexObj</A>*      obj,
19void*          image_ptr,
20u16            width,
21u16            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,
26u32            tlut_name);</CODE></PRE>
27</DL>
28<H2>Arguments</H2>
29<TABLE border="1" cellpadding="3" cellspacing="0.1">
30  <TBODY>
31    <TR>
32<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>obj</CODE></STRONG></EM></TD>
33<TD width="520">pointer to a texture object</TD>
34    </TR>
35    <TR>
36<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>image_ptr</CODE></STRONG></EM></TD>
37<TD width="520">pointer to the image data for a texture <BR>32-byte aligned</TD>
38    </TR>
39    <TR>
40<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>width</CODE></STRONG></EM></TD>
41<TD width="520">width of the texture or LOD 0 for mipmaps <BR>The maximum value is 1024. Mipmaps must be a power of two. If <code>GX_REPEAT/GX_MIRROR</code> is set for <CODE>wrap_s</CODE>, the width must be a power of two.</TD>
42    </TR>
43    <TR>
44<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>height</CODE></STRONG></EM></TD>
45<TD width="520">height of the texture or LOD 0 for mipmaps <BR>The maximum value is 1024. Mipmaps must be a power of two. If <code>GX_REPEAT/GX_MIRROR</code> is set for <CODE>wrap_t</CODE>, the width must be a power of two.</TD>
46    </TR>
47    <TR>
48<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>format</CODE></STRONG></EM></TD>
49<TD width="520">the texel <A href="../Enumerated_Types/GXCITexFmt.html">format</A>&nbsp;<BR>Accepted values are:<BR>
50      <TABLE border="1" width="500" cellspacing="0.1">
51
52          <tr>
53<TD width="150" bgcolor="#C0C0C0">Name</TD>
54<TD width="350" bgcolor="#C0C0C0">Texture Format</TD>
55          </tr>
56          <tr>
57<TD width="150"><code>GX_TF_C4</code></TD>
58<TD width="350">4-bit color index</TD>
59          </tr>
60          <tr>
61<TD width="150"><code>GX_TF_C8</code></TD>
62<TD width="350">8-bit color index</TD>
63          </tr>
64          <tr>
65<TD width="150"><code>GX_TF_C14X2</code></TD>
66<TD width="350">14-bit color index</TD>
67          </tr>
68
69      </TABLE>
70      </TD>
71    </TR>
72    <TR>
73<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>wrap_s</CODE></STRONG></EM></TD>
74<TD width="520">describes how texture coordinates will be wrapped in the s direction <BR>Accepted values are:<BR>
75      <TABLE border="1" width="500" cellspacing="0.1">
76
77          <tr>
78<TD width="150" bgcolor="#C0C0C0">Name</TD>
79<TD width="350" bgcolor="#C0C0C0">Wrap Mode</TD>
80          </tr>
81          <tr>
82<TD width="150"><code>GX_CLAMP</code></TD>
83<TD width="350">clamping within the bounds of the image</TD>
84          </tr>
85          <tr>
86<TD width="150"><code>GX_REPEAT</code></TD>
87<TD width="350">simple repeating</TD>
88          </tr>
89          <tr>
90<TD width="150"><code>GX_MIRROR</code></TD>
91<TD width="350">repeating with mirroring</TD>
92          </tr>
93
94      </TABLE>
95      </TD>
96    </TR>
97    <TR>
98<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>wrap_t</CODE></STRONG></EM></TD>
99<TD width="520">describes how texture coordinates will be wrapped in the t direction <BR>Accepted values are:<BR>
100      <TABLE border="1" width="500" cellspacing="0.1">
101
102          <tr>
103<TD width="150" bgcolor="#C0C0C0">Name</TD>
104<TD width="350" bgcolor="#C0C0C0">Wrap Mode</TD>
105          </tr>
106          <tr>
107<TD width="150"><code>GX_CLAMP</code></TD>
108<TD width="350">clamping within the bounds of the image</TD>
109          </tr>
110          <tr>
111<TD width="150"><code>GX_REPEAT</code></TD>
112<TD width="350">simple repeating</TD>
113          </tr>
114          <tr>
115<TD width="150"><code>GX_MIRROR</code></TD>
116<TD width="350">repeating with mirroring</TD>
117          </tr>
118
119      </TABLE>
120      </TD>
121    </TR>
122    <TR>
123<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>mipmap</CODE></STRONG></EM></TD>
124<TD width="520">If <CODE>mipmap</CODE> = <CODE>GX_TRUE</CODE>, this is a mipmap texture. Otherwise, this is a 2D texture.</TD>
125    </TR>
126    <TR>
127<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>tlut_name</CODE></STRONG></EM></TD>
128<TD width="520">texture lookup table name used for this texture&nbsp;<BR>The default texture setting takes a name found in <A href="../Enumerated_Types/GXTlut.html"><CODE>GXTlut</CODE></A>.</TD>
129    </TR>
130  </TBODY>
131</TABLE>
132<H2>Return Values</H2>
133<P>None.</P>
134<H2>Description</H2>
135<P>This function is used to initialize or change texture objects when the texture is in the color index (CI) format.&nbsp;Texture objects are used to describe all parameters associated with a texture, including size, format, wrap modes, filter modes, etc.&nbsp;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>
136<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).&nbsp;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 bilerped.&nbsp;See <a href="GXInitTexObjLOD.html"><code>GXInitTexObjLOD</code></a> 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>
137<P>Non-mipmap (planar) textures do not have to be a power of two.&nbsp;However, to use the <code>GX_REPEAT</code> or <code>GX_MIRROR</code> modes for <CODE>wrap_s</CODE> and <CODE>wrap_t</CODE> the width and height must be powers of two.</P>
138<P><CODE>tlut_name</CODE> is used to indicate which texture lookup table (TLUT) to use.&nbsp;</P>
139<P>The default texture pipeline as configured by <a href="../Management/GXInit.html"><code>GXInit</code></a> uses the names in <a href="../Enumerated_Types/GXTlut.html"><code>GXTlut</code></a>. Default settings provide thirty-two 256-entry TLUTs.&nbsp;A default callback function is used to convert these names to texture memory addresses when the TLUT or color index texture object is loaded.&nbsp;To make new TLUTs or allocate TLUTs differently, you must:</P>
140<UL>
141<LI>Allocate the <a href="GXInitTlutRegion.html"><code>GXTlutRegions</code></a> function using <a     href="GXInitTlutRegion.html"><code>GXInitTlutRegion</code></a>.
142<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.
143</UL>
144<P>Keep in mind that texture caches, pre-loaded textures and TLUTs share the texture memory.&nbsp;Changes in TLUT allocation should also be accompanied by changes in texture cache and pre-loaded texture allocation.</P>
145<H2>See Also</H2>
146<P><A href="GXLoadTexObj.html"><CODE>GXLoadTexObj</CODE></A><BR> <A href="GXLoadTlut.html"><CODE>GXLoadTlut</CODE></A><BR> <A href="GXInitTexCacheRegion.html"><CODE>GXInitTexCacheRegion</CODE></A><BR> <CODE><A href="GXSetTexRegionCallback.html">GXSetTexRegionCallBack</A></CODE></P>
147<P><A href="GXTexObjInitFlow.html"><CODE>GXTexObj</CODE> Initialization Flow</A></P>
148<H2>Revision History</H2>
149<P>03/01/2006 Initial version.</P>
150</BODY>
151</HTML>