engine/wii/video.c
/**
 * Initializes GX, the API used for communicating with the Flipper/Hollywood GPU.
 */
Initializes GX, the API used for communicating with the Flipper/Hollywood GPU.
Initializes GX the API used for communicating with the Flipper / Hollywood GPU .
void video_gx_init()
{
	GXColor background = {0, 0, 0, 0xff};
	memset(gp_fifo, 0, DEFAULT_FIFO_SIZE);
	GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
	GX_SetCopyClear(background, 0x00ffffff);
	GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
	GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);
	GX_SetDispCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
	GX_SetDispCopyDst(vmode->fbWidth, vmode->xfbHeight);
	GX_SetDispCopyYScale(GX_GetYScaleFactor(vmode->efbHeight, vmode->xfbHeight));
	GX_SetCopyFilter(vmode->aa, vmode->sample_pattern, GX_TRUE, vmode->vfilter);
	GX_SetPixelFmt(vmode->aa ? GX_PF_RGB565_Z16 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);
	GX_SetCullMode(GX_CULL_NONE);
	GX_SetFieldMode(vmode->field_rendering, ((vmode->viHeight == 2*vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
	GX_SetColorUpdate(GX_TRUE);
	GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_DISABLE);
	GX_ClearVtxDesc();
	GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
	GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
	GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
	GX_SetNumChans(0);
	GX_SetNumTexGens(1);
	GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
	GX_SetNumTevStages(1);
	GX_SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC);
	GX_SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
	GX_SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
	GX_SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
	video_set_color_correction(0, 0);
	guOrtho(perspective, 0, viewportHeight-1, 0, viewportWidth-1, 0, 300);
	GX_LoadProjectionMtx(perspective, GX_ORTHOGRAPHIC);
	guMtxIdentity(modelview);
	GX_LoadPosMtxImm(modelview, GX_PNMTX0);
	GX_InitTlutObj(&tlut, palette, GX_TL_RGB565, 256);
}
void video_gx_init ( ) { GXColor background = { 0 , 0 , 0 , 0xff } ; memset ( gp_fifo , 0 , DEFAULT_FIFO_SIZE ) ; GX_Init ( gp_fifo , DEFAULT_FIFO_SIZE ) ; GX_SetCopyClear ( background , 0x00ffffff ) ; GX_SetViewport ( 0 , 0 , vmode -> fbWidth , vmode -> efbHeight , 0 , 1 ) ; GX_SetScissor ( 0 , 0 , vmode -> fbWidth , vmode -> efbHeight ) ; GX_SetDispCopySrc ( 0 , 0 , vmode -> fbWidth , vmode -> efbHeight ) ; GX_SetDispCopyDst ( vmode -> fbWidth , vmode -> xfbHeight ) ; GX_SetDispCopyYScale ( GX_GetYScaleFactor ( vmode -> efbHeight , vmode -> xfbHeight ) ) ; GX_SetCopyFilter ( vmode -> aa , vmode -> sample_pattern , GX_TRUE , vmode -> vfilter ) ; GX_SetPixelFmt ( vmode -> aa ? GX_PF_RGB565_Z16 : GX_PF_RGB8_Z24 , GX_ZC_LINEAR ) ; GX_SetCullMode ( GX_CULL_NONE ) ; GX_SetFieldMode ( vmode -> field_rendering , ( ( vmode -> viHeight == 2 * vmode -> xfbHeight ) ? GX_ENABLE : GX_DISABLE ) ) ; GX_SetColorUpdate ( GX_TRUE ) ; GX_SetZMode ( GX_DISABLE , GX_ALWAYS , GX_DISABLE ) ; GX_ClearVtxDesc ( ) ; GX_SetVtxDesc ( GX_VA_POS , GX_DIRECT ) ; GX_SetVtxDesc ( GX_VA_TEX0 , GX_DIRECT ) ; GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_POS , GX_POS_XY , GX_F32 , 0 ) ; GX_SetVtxAttrFmt ( GX_VTXFMT0 , GX_VA_TEX0 , GX_TEX_ST , GX_F32 , 0 ) ; GX_SetNumChans ( 0 ) ; GX_SetNumTexGens ( 1 ) ; GX_SetTexCoordGen ( GX_TEXCOORD0 , GX_TG_MTX2x4 , GX_TG_TEX0 , GX_IDENTITY ) ; GX_SetNumTevStages ( 1 ) ; GX_SetTevColorIn ( GX_TEVSTAGE0 , GX_CC_ZERO , GX_CC_ZERO , GX_CC_ZERO , GX_CC_TEXC ) ; GX_SetTevColorOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ; GX_SetTevAlphaIn ( GX_TEVSTAGE0 , GX_CA_ZERO , GX_CA_ZERO , GX_CA_ZERO , GX_CA_TEXA ) ; GX_SetTevAlphaOp ( GX_TEVSTAGE0 , GX_TEV_ADD , GX_TB_ZERO , GX_CS_SCALE_1 , GX_TRUE , GX_TEVPREV ) ; video_set_color_correction ( 0 , 0 ) ; guOrtho ( perspective , 0 , viewportHeight - 1 , 0 , viewportWidth - 1 , 0 , 300 ) ; GX_LoadProjectionMtx ( perspective , GX_ORTHOGRAPHIC ) ; guMtxIdentity ( modelview ) ; GX_LoadPosMtxImm ( modelview , GX_PNMTX0 ) ; GX_InitTlutObj ( & tlut , palette , GX_TL_RGB565 , 256 ) ; }
Initializes GX, the API used for communicating with the Flipper/Hollywood GPU.
Initializes GX the API used for communicating with the Flipper / Hollywood GPU .
// clear out FIFO area and initialize GX // clear the screen to black when GX_CopyDisp is called with clear=GX_TRUE // set up viewport // other GX setup // set up the vertex descriptors - tell the Flipper/Hollywood to expect direct, floating-point data /* set up Texture Environment (TEV), although the brightness/_gamma adjustment
	 * in video_render_screen() will override parts of this configuration later */ // set up an orthographic perspective // set up the model view // initialize texture look-up table (TLUT) used in 8-bit (indexed) color mode