void drawInit() { Mtx44 GXprojection2D; Mtx GXmodelView2D; // Reset various parameters from gfx plugin GX_SetCoPlanar(GX_DISABLE); GX_SetClipMode(GX_CLIP_ENABLE); // GX_SetScissor(0,0,vmode->fbWidth,vmode->efbHeight); GX_SetAlphaCompare(GX_ALWAYS,0,GX_AOP_AND,GX_ALWAYS,0); guMtxIdentity(GXmodelView2D); GX_LoadTexMtxImm(GXmodelView2D,GX_TEXMTX0,GX_MTX2x4); GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX0); guOrtho(GXprojection2D, 0, 479, 0, 639, 0, 700); GX_LoadProjectionMtx(GXprojection2D, GX_ORTHOGRAPHIC); // GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1); GX_SetZMode(GX_DISABLE,GX_ALWAYS,GX_TRUE); GX_ClearVtxDesc(); GX_SetVtxDesc(GX_VA_PTNMTXIDX, GX_PNMTX0); GX_SetVtxDesc(GX_VA_TEX0MTXIDX, GX_TEXMTX0); GX_SetVtxDesc(GX_VA_POS, GX_DIRECT); GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT); GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT); //set vertex attribute formats here GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0); GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); //enable textures GX_SetNumChans (1); GX_SetNumTexGens (1); GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GX_SetNumTevStages (1); GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); //set blend mode GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); //Fix src alpha GX_SetColorUpdate(GX_ENABLE); // GX_SetAlphaUpdate(GX_ENABLE); // GX_SetDstAlpha(GX_DISABLE, 0xFF); //set cull mode GX_SetCullMode (GX_CULL_NONE); }
void wii_video_init(void) { VIDEO_Init(); GXRModeObj *mode = VIDEO_GetPreferredMode(NULL); setup_video_mode(mode); GX_Init(gx_fifo, sizeof(gx_fifo)); GX_SetDispCopyGamma(GX_GM_1_0); GX_SetCullMode(GX_CULL_NONE); GX_SetClipMode(GX_CLIP_DISABLE); init_vtx(mode); build_disp_list(); g_filter = true; g_vsync = true; }