#include <revolution/gx.h>
void GXSetPixelFmt(
GXPixelFmt pix_fmt,
GXZFmt16 z_fmt );
pix_fmt |
pixel format Accepted values are:
GX_PF_RGB565_Z16 is selected, anti-aliasing mode is turned on. It's off otherwise. |
||||||||||
z_fmt |
The compression type for the 16-bit Z format. Accepted values are:
|
None.
This function sets the format of pixels in the embedded frame buffer (EFB) internal to the graphics processor. It also controls the anti-aliasing (AA) mode.
There are two non-antialiased pix_fmt pixel formats, GX_PF_RGB8_Z24 and GX_PF_RGBA6_Z24. The EFB stride is 640 pixels. The non-antialiased EFB has 528 lines available.
When pix_fmt is GX_PF_RGB565_Z16, multi-sample anti-aliasing is enabled. In order to get the correct results, GXSetCopyFilter must also be called. The position of the subsamples and the anti-aliasing filter coefficients are set using GXSetCopyFilter. 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).
GXSetPixelFmt also sets the compression type for 16-bit Z formats, which allows Z precision trade-offs within the range. The following guidelines apply:
a) far/near ratio <= 2^16, use GX_ZC_LINEAR
b) far/near ratio <= 2^18, use GX_ZC_NEAR
c) far/near ratio <= 2^20, use GX_ZC_MID
d) far/near ratio <= 2^24, use GX_ZC_FAR
It is always best to use as little compression as possible (choice a is least compressed, choice d is most compressed). Higher compression results in less precision. The far in the above list does not necessarily reference the far clipping plane. You should think of it as the farthest object that you want to have accurate occlusion.
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.
03/01/2006 Initial version.