forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

libito itoLoadTexture problem

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
KaylaKaze



Joined: 05 May 2004
Posts: 75
Location: NC, USA

PostPosted: Sun Jun 06, 2004 7:08 am    Post subject: libito itoLoadTexture problem Reply with quote

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:


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.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Mon Jun 07, 2004 5:43 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
linuzappz



Joined: 30 Apr 2004
Posts: 6

PostPosted: Mon Jun 07, 2004 11:26 pm    Post subject: Reply with quote

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 :).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group