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>GXInitTexObjLOD</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXInitTexObjLOD</H1> 12<H2>C Specification</H2> 13<DL> 14 <DD> 15<PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17<PRE><CODE>void GXInitTexObjLOD( 18<a href="../Structures/GXTexObj.html">GXTexObj</a>* obj, 19<a href="../Enumerated_Types/GXTexFilter.html">GXTexFilter</a> min_filt, 20<a href="../Enumerated_Types/GXTexFilter.html">GXTexFilter</a> mag_filt, 21f32 min_lod, 22f32 max_lod, 23f32 lod_bias, 24<a href="../Enumerated_Types/GXBool.html">GXBool</a> bias_clamp, 25<a href="../Enumerated_Types/GXBool.html">GXBool</a> do_edge_lod, 26<a href="../Enumerated_Types/GXAnisotropy.html">GXAnisotropy</a> max_aniso );</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>min_filt</CODE></STRONG></EM></TD> 37<TD width="520">filter mode used when texel/pixel ratio is &ge; 1.0 <BR>Accepted values are:<BR> 38 <TABLE border="1" width="500" cellspacing="0.1"> 39 40 <tr> 41<TD width="150" bgcolor="#C0C0C0">Name</TD> 42<TD width="350" bgcolor="#C0C0C0">Filter Type</TD> 43 </tr> 44 <tr> 45<TD width="150"><code>GX_NEAR</code></TD> 46<TD width="350">point sampling, no mipmap</TD> 47 </tr> 48 <tr> 49<TD width="150"><code>GX_LINEAR</code></TD> 50<TD width="350">bi-linear filtering, no mipmap</TD> 51 </tr> 52 <tr> 53<TD width="150"><code>GX_NEAR_MIP_NEAR</code></TD> 54<TD width="350">point sampling, mipmap without interpolation</TD> 55 </tr> 56 <tr> 57<TD width="150"><code>GX_LIN_MIP_NEAR</code></TD> 58<TD width="350">bi-linear filtering, mipmap without interpolation</TD> 59 </tr> 60 <tr> 61<TD width="150"><code>GX_NEAR_MIP_LIN</code></TD> 62<TD width="350">point sampling, linear mipmap</TD> 63 </tr> 64 <tr> 65<TD width="150"><code>GX_LIN_MIP_LIN</code></TD> 66<TD width="350">tri-linear filtering</TD> 67 </tr> 68 69 </TABLE> 70 </TD> 71 </TR> 72 <TR> 73<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>mag_filt</CODE></STRONG></EM></TD> 74<TD width="520">filter mode used when the texel/pixel ratio is < 1.0 <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">Filter Type</TD> 80 </tr> 81 <tr> 82<TD width="150"><code>GX_NEAR</code></TD> 83<TD width="350">point sampling</TD> 84 </tr> 85 <tr> 86<TD width="150"><code>GX_LINEAR</code></TD> 87<TD width="350">bi-linear filtering</TD> 88 </tr> 89 90 </TABLE> 91 </TD> 92 </TR> 93 <TR> 94<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>min_lod</CODE></STRONG></EM></TD> 95<TD width="520">minimum LOD value <BR>The hardware uses <CODE>MAX(min_lod, lod)</CODE>. The range is from 0.0 to 10.0.</TD> 96 </TR> 97 <TR> 98<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>max_lod</CODE></STRONG></EM></TD> 99<TD width="520">the maximum LOD value The hardware uses <CODE>MIN(max_lod, lod)</CODE>. The range is from 0.0 to 10.0.</TD> 100 </TR> 101 <TR> 102<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>lod_bias</CODE></STRONG></EM></TD> 103<TD width="520">the bias to add to computed LOD value</TD> 104 </TR> 105 <TR> 106<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>bias_clamp</CODE></STRONG></EM></TD> 107<TD width="520">clamps <CODE>(LOD + lod_bias)</CODE> so that it can never be smaller than the reduced area of the pixel projection in texture space for <CODE>GX_ENABLE</CODE><BR>Prevents over-biasing the LOD when the polygon is perpendicular to the line of sight.</TD> 108 </TR> 109 <TR> 110<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>do_edge_lod</CODE></STRONG></EM></TD> 111<TD width="520">the LOD is calculated using texel interpolation for <CODE>GX_ENABLE</CODE><BR>Use diagonal texels when <CODE>GX_TRUE</CODE> is not in use. This must be <CODE>GX_ENABLE</CODE> when using a bias clamp (when <CODE>bias_clamp</CODE> is set to <CODE>GX_ENABLE</CODE>) or when performing anisotropic filtering (when <CODE>max_aniso</CODE> is set to <CODE>GX_ANISO_2</CODE> or <CODE>GX_ANISO_4</CODE>).</TD> 112 </TR> 113 <TR> 114<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>max_aniso</CODE></STRONG></EM></TD> 115<TD width="520">the maximum <a href="../Enumerated_Types/GXAnisotropy.html">anisotropic</a> filter to use <BR>Accepted values are:<BR> 116 <TABLE border="1" width="500" cellspacing="0.1"> 117 118 <tr> 119<TD width="150" bgcolor="#C0C0C0">Name</TD> 120<TD width="350" bgcolor="#C0C0C0">Filter Type</TD> 121 </tr> 122 <tr> 123<TD width="150"><code>GX_ANISO_1</code></TD> 124<TD width="350">maximum anisotropy = 1 (no anisotropic filtering)</TD> 125 </tr> 126 <tr> 127<TD width="150"><code>GX_ANISO_2</code></TD> 128<TD width="350">maximum anisotropy = 2</TD> 129 </tr> 130 <tr> 131<TD width="150"><code>GX_ANISO_4</code></TD> 132<TD width="350">maximum anisotropy = 4</TD> 133 </tr> 134 135 </TABLE> 136This functions only when <code>GX_LIN_MIP_LIN</code> has been set for <CODE>min_filt</CODE>.</TD> 137 </TR> 138 </TBODY> 139</TABLE> 140<H2>Return Values</H2> 141<P>None.</P> 142<H2>Description</H2> 143<P>This function explicitly sets texture level of detail (LOD) controls for a texture object. The application must provide memory for a texture object. When initializing a texture object using <a href="GXInitTexObj.html"><code>GXInitTexObj</code></a> or <a href="GXInitTexObjCI.html"><code>GXInitTexObjCI</code></a>, this information is set to default values based on the <code>mipmap</code> flag. This function allows the programmer to override those defaults. Be aware that this function should be called after <a href="GXInitTexObj.html"><code>GXInitTexObj</code></a> or <code><a href="GXInitTexObjCI.html">GXInitTexObjCI</a></code> for each texture object. </P> 144<P>The hardware supports anisotropic texture filtering. The default <CODE>max_aniso</CODE> setting of <code>GX_ANISO_1</code> uses a standard square filter to approximate the quadrilateral formed when a pixel is projected in texture space. This type of filter is said to be isotropic. Anisotropic filtering is accomplished by iterating the square filter along the direction of anisotropy to better approximate the quadrilateral. This type of filtering results in sharper textures at the expense of multiple cycles per quad. The hardware will only use multiple cycles when necessary, and the maximum number of cycles is clamped by the <CODE>max_aniso</CODE> argument. Setting <CODE>max_aniso</CODE> to <CODE>GX_ANISO_2</CODE> will therefore use a maximum of two filter cycles per texture. Be aware that these filter cycles are internal to the texture filter hardware and do not effect the available number of TEV stages. When setting <CODE>max_aniso</CODE> to <code>GX_ANISO_2</code> or <code>GX_ANISO_4</code>, the <CODE>min_filt</CODE> argument must be set to <code>GX_LIN_MIP_LIN</code>. </P> 145<P>The LOD computed by the graphics hardware can be biased using the <CODE>lod_bias</CODE> argument. <CODE>lod_bias</CODE> is added to the calculated LOD and the result is clamped between <CODE>min_lod</CODE> and <CODE>max_lod</CODE>. If <CODE>bias_clamp</CODE> is enabled, the effect of <CODE>lod_bias</CODE> will diminish as the polygon becomes more perpendicular to the view direction. This prevents over-sharpening the texture in this situation, but allows LOD biasing for oblique polygons.</P> 146<H2>Performance Notes</H2> 147<P>Theoretically, there is no performance difference amongst various magnification/reduction filter settings except for the <code>GX_LIN_MIP_LIN</code> filter with the <code>GX_TF_RGBA8</code> texture format, which requires twice as much processing as other formats. However, this assumes an environment where the texture cache can always be hit. On real environments, you will see some performance differences by changing the filter modes (especially the reduction filter) because the cache-hit ratio changes with the filter mode in use.</P> 148<P>The following is the list of reduction filters sorted in ordinary performance order:</P> 149<UL> 150<LI><code>GX_NEAR_MIP_NEAR</code> (fastest) 151<LI><CODE>GX_LIN_MIP_NEAR</CODE> 152<LI><CODE>GX_NEAR_MIP_LIN</CODE> 153<LI><CODE>GX_LIN_MIP_LIN</CODE> 154<LI><CODE>GX_NEAR</CODE> 155<LI><code>GX_LINEAR</code> (slowest)<br> 156</UL> 157<H2>See Also</H2> 158<P><A href="GXLoadTexObj.html"><CODE>GXLoadTexObj</CODE></A><BR> <A href="GXInitTexObj.html"><CODE>GXInitTexObj</CODE></A><BR> <A href="GXInitTexObjCI.html"><CODE>GXInitTexObjCI</CODE></A><BR> <A href="GXGetTexObjLODAll.html"><CODE>GXGetTexObjLODAll</CODE></A></P> 159<P><A href="GXTexObjInitFlow.html"><CODE>GXTexObj</CODE> Initialization Flow</A></P> 160<H2>Revision History</H2> 161<P>03/01/2006 Initial version.</P></BODY> 162</HTML>