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>GXSetPixelFmt</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetPixelFmt</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 GXSetPixelFmt(
18<A href="../Enumerated_Types/GXPixelFmt.html">GXPixelFmt</A>    pix_fmt,
19<A href="../Enumerated_Types/GXZFmt16.html">GXZFmt16</A>      z_fmt );</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>pix_fmt</CODE></STRONG></EM></TD>
26<TD width="520">pixel format <BR>Accepted values are:<BR>
27      <TABLE border="1" width="500" cellpadding="3" cellspacing="0.1">
28
29          <tr>
30<TD width="150" bgcolor="#C0C0C0">Name</TD>
31<TD width="350" bgcolor="#C0C0C0">Pixel Format</TD>
32          </tr>
33          <tr>
34<TD width="150"><code>GX_PF_RGB8_Z24</code></TD>
35<TD width="350">no anti-aliasing 8-bit for each RGB value, 24-bit Z value.</TD>
36          </tr>
37          <tr>
38<TD width="150"><code>GX_PF_RGBA6_Z24</code></TD>
39<TD width="350">no anti-aliasing 6-bit for each RGBA value, 24-bit Z value.</TD>
40          </tr>
41          <tr>
42<TD width="150"><code>GX_PF_RGB565_Z16</code></TD>
43<TD width="350">anti-aliasing RGB565, 16-bit Z value</TD>
44          </tr>
45
46      </TABLE>
47When <CODE>GX_PF_RGB565_Z16</CODE> is selected, anti-aliasing mode is turned on. It's off otherwise.</TD>
48    </TR>
49    <TR>
50<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>z_fmt</CODE></STRONG></EM></TD>
51<TD width="520">The compression type for the 16-bit Z <A href="../Enumerated_Types/GXZFmt16.html">format</A>. <BR>Accepted values are:<BR>
52      <TABLE border="1" width="500" cellpadding="3" cellspacing="0.1">
53
54          <tr>
55<TD width="150" bgcolor="#C0C0C0">Name</TD>
56<TD width="350" bgcolor="#C0C0C0">Z format</TD>
57          </tr>
58          <tr>
59<TD width="150"><code>GX_ZC_LINEAR</code></TD>
60<TD width="350">linear 16-bit</TD>
61          </tr>
62          <tr>
63<TD width="150"><code>GX_ZC_NEAR</code></TD>
64<TD width="350">compressed format for smaller far/near ratios</TD>
65          </tr>
66          <tr>
67<TD width="150"><code>GX_ZC_MID</code></TD>
68<TD width="350">compressed format for medium far/near ratios</TD>
69          </tr>
70          <tr>
71<TD width="150"><code>GX_ZC_FAR</code></TD>
72<TD width="350">compressed format for large far/near ratios</TD>
73          </tr>
74
75      </TABLE>
76This argument is ignored if a 24-bit Z format is selected.</TD>
77    </TR>
78  </TBODY>
79</TABLE>
80<H2>Return Values</H2>
81<P>None.</P>
82<H2>Description</H2>
83<P>This function sets the format of pixels in the embedded frame buffer (EFB) internal to the graphics processor.&nbsp;It also controls the anti-aliasing (AA) mode.</P>
84<P>There are two non-antialiased <code>pix_fmt</code> pixel formats, <code>GX_PF_RGB8_Z24</code> and <code>GX_PF_RGBA6_Z24</code>.&nbsp;The EFB stride is 640 pixels. The non-antialiased EFB has 528 lines available.</P>
85<P>When <code>pix_fmt</code> is <code>GX_PF_RGB565_Z16</code>, multi-sample anti-aliasing is enabled.&nbsp;In order to get the correct results, <a href="../Framebuffer/GXSetCopyFilter.html"><code>GXSetCopyFilter</code></a> must also be called.&nbsp;The position of the subsamples and the anti-aliasing filter coefficients are set using <a href="../Framebuffer/GXSetCopyFilter.html"><code>GXSetCopyFilter</code></a>. When anti-aliasing, three 16-bit color/Z samples are calculated for each pixel, and the total available number of pixels in the EFB is reduced by half (640 pixels x 264 lines).&nbsp;</P>
86<P><a href="GXSetPixelFmt.html"><code>GXSetPixelFmt</code></a> also sets the compression type for 16-bit Z formats, which allows Z precision trade-offs within the range.&nbsp;The following guidelines apply:</P>
87<P>a) far/near ratio &lt;= 2^16, use <code>GX_ZC_LINEAR</code><BR> b) far/near ratio &lt;= 2^18, use <code>GX_ZC_NEAR</code><BR> c) far/near ratio &lt;= 2^20, use <code>GX_ZC_MID</code><BR> d) far/near ratio &lt;= 2^24, use <code>GX_ZC_FAR</code></P>
88<P>It is always best to use as little compression as possible (choice <I>a</I> is least compressed, choice <I>d</I> is most compressed).&nbsp;Higher compression results in less precision.&nbsp;The <B>far</B> in the above list does not necessarily reference the far clipping plane.&nbsp;You should think of it as the farthest object that you want to have accurate occlusion.</P>
89<H2>Performance Notes</H2>
90<P>Since changing the pixel format requires the pixel pipeline to be synchronized, the use of this function causes the graphics processor to stall as a result. Therefore, redundant calls of this function should be avoided.</P>
91
92<H2>See Also</H2>
93<P><A href="../Framebuffer/GXSetCopyFilter.html"><CODE>GXSetCopyFilter</CODE></A><br> <A href="../Framebuffer/GXCopyDisp.html"><CODE>GXCopyDisp</CODE></A></P>
94<H2>Revision History</H2>
95<P>03/01/2006 Initial version.</P>
96</BODY>
97</HTML>