From fad26aecb770862a20b89ac6ad199659c73f2e7a Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Mon, 27 Oct 2008 13:57:12 +0000 Subject: [PATCH] fixed some stuff with texture rendering --- source/ngc/gcvideo.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/ngc/gcvideo.c b/source/ngc/gcvideo.c index 711d569..5d7500f 100644 --- a/source/ngc/gcvideo.c +++ b/source/ngc/gcvideo.c @@ -614,14 +614,12 @@ ResetVideo_Emu () guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 10, 1000); // matrix, t, b, l, r, n, f GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC); + // reinitialize texture + GX_InvalidateTexAll (); GX_InitTexObj (&texobj, texturemem, TEX_WIDTH, TEX_HEIGHT, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE); // initialize the texture obj we are going to use - if (!(GCSettings.render&1)) GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,2.5,9.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1); // original/unfiltered video mode: force texture filtering OFF - GX_LoadTexObj (&texobj, GX_TEXMAP0); // load texture object so its ready to use - - UpdateScaling(); } @@ -684,7 +682,10 @@ void RenderFrame(unsigned char *XBuf) u8 *src3 = XBuf + 512; u8 *src4 = XBuf + 768; - // Now draw the texture + /* clear texture objects in memory */ + GX_InvalidateTexAll(); + + // Now draw the texture for (height = 0; height < 240; height += 4) { for (width = 0; width < 256; width += 4) @@ -719,17 +720,16 @@ void RenderFrame(unsigned char *XBuf) src4 += 768; // line 4*(N+3) } - DCFlushRange(texturemem, TEX_WIDTH * TEX_HEIGHT * 2); - - /* setup GX */ - GX_InvalidateTexAll(); + /* load texture into GX */ + DCFlushRange(texturemem, TEX_WIDTH * TEX_HEIGHT * 2); + GX_LoadTexObj (&texobj, GX_TEXMAP0); + /* render textured quad */ draw_square(view); - GX_DrawDone(); - - VIDEO_SetNextFramebuffer(xfb[whichfb]); + /* EFB is ready to be copied into XFB */ + VIDEO_SetNextFramebuffer(xfb[whichfb]); VIDEO_Flush(); copynow = GX_TRUE;