Page 1 of 1

libito itoLoadTexture problem

Posted: Sun Jun 06, 2004 7:08 am
by KaylaKaze
I know I should probably be using gslib for graphics but PS2Menu uses libito and I don't feel like doing a rewrite to use gslib at the moment. Anyway, I'm adding (or trying to) JPG and BMP viewer support. Both are working well enough so I end up with a plain RGB24 bitmap (u8 array). The problem I'm having is when I use itoLoadTexture to load it so I can use a sprite to dsplay it, the sprite never displays. I've experimentally set the texture buffer to the screen buffer and LoadTexture is moving the data properly (though the bottom half of the graphic is cut off). Is there something wrong with my code?

Code: Select all


void PutImage(void)
{
	itoGsFinish();
	itoSwitchFrameBuffers();
	itoVSync();
	}

///--------cut

itoSetTextureBufferBase( itoGetZBufferBase() ); //zbuffer isn't used
itoLoadTexture(buffer, 0, 512, ITO_RGB24, 0, 0, info.width/zoom, info.height/zoom);
PutImage();           
      
while (!end)
{
          itoSetTexture(0, 512, ITO_RGB24, ITO_TEXTURE_512,ITO_TEXTURE_512);
          itoTextureSprite(ITO_RGBA(0x80,0x80,0x80,0xFF), 50,50, 0, 0,50+(info.width/zoom),50+(info.height/zoom), info.width/zoom,info.height/zoom, 0);
          PutImage();

//gamepad handling
}
zoom is used with the original buffer to scale the graphic down so it can better fit in VRAM. The output is okay because I checked it by using itoPoint to draw the image. If I add a regular itoSprite command under the itoTextureSprite, it doesn't show up either.

Posted: Mon Jun 07, 2004 5:43 am
by Lukasz
Its been a very long time since I last used or look at the source of any version of my lib which is avaliable. However I do recall a problem with huge textures such as the one you an uploading (512x512x24bit) and linuzappz just told me the other day about a bug which he found when he ported libjpg, he will probably be of more assistence than I.

I've now converted to C++ and will shortly be releasing version 1.0.0 of ito, its the one i used to code by lastest "Torus" demo avaliable at www.thethirdcreation.net

If any one wants to take over development the pure C version of libito, be my guest.

Posted: Mon Jun 07, 2004 11:26 pm
by linuzappz
hi, here is my patch for the itoLoadTexture prob:

*** itogs.c 2004-06-07 10:24:14.000000000 -0300
--- itogsorig.c 2002-11-15 00:00:00.000000000 -0300
***************
*** 340,353 ****

for(i=0; i < packets; i++)
{
! itoDmaTag(6, 0, DMA_TAG_ID_REF, 0, (uint32)regs+(i*6*16), DMA_TAG_SPR_MEM);
itoDmaTag(PACKET_MAX_SIZE/16, 0, DMA_TAG_ID_REF, 0, src+(i*PACKET_MAX_SIZE), DMA_TAG_SPR_MEM);
}

i = 0;
if(packet_rest)
{
! itoDmaTag(6, 0, DMA_TAG_ID_REF, 0, (uint32)regs+(packets*6*16), DMA_TAG_SPR_MEM);
itoDmaTag(packet_rest/16, 0, DMA_TAG_ID_REF, 0, src+(packets*PACKET_MAX_SIZE), DMA_TAG_SPR_MEM);
i = 1;
}
--- 340,353 ----

for(i=0; i < packets; i++)
{
! itoDmaTag(6, 0, DMA_TAG_ID_REF, 0, regs+(i*6*16), DMA_TAG_SPR_MEM);
itoDmaTag(PACKET_MAX_SIZE/16, 0, DMA_TAG_ID_REF, 0, src+(i*PACKET_MAX_SIZE), DMA_TAG_SPR_MEM);
}

i = 0;
if(packet_rest)
{
! itoDmaTag(6, 0, DMA_TAG_ID_REF, 0, regs+(packets*6*16), DMA_TAG_SPR_MEM);
itoDmaTag(packet_rest/16, 0, DMA_TAG_ID_REF, 0, src+(packets*PACKET_MAX_SIZE), DMA_TAG_SPR_MEM);
i = 1;
}
***************
*** 356,362 ****
// dma tag for texflush
// -------------------------------------------------

! itoDmaTag(2, 0, DMA_TAG_ID_REF, 0, (uint32)regs+((packets+i)*6*16), DMA_TAG_SPR_MEM);
// -------------------------------------------------
// end dma chain transfer
// -------------------------------------------------
--- 356,362 ----
// dma tag for texflush
// -------------------------------------------------

! itoDmaTag(2, 0, DMA_TAG_ID_REF, 0, regs+((packets+i)*6*16), DMA_TAG_SPR_MEM);
// -------------------------------------------------
// end dma chain transfer
// -------------------------------------------------



hope it helps :).