gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Changing texture data

#123191 - zeGouky - Mon Mar 26, 2007 1:08 am

Hi all,

i was wondering how to change the texture data after allocation and i found some answers on the forum but i get black pixel on the first 64 lines of the screen.

To change the texture data i'm using the function glTexImage2D_retAddr found on the forum and when i want to change the data im doing like that :

Code:

      uint32 vram_temp = vramSetMainBanks( VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD);

      dmaCopy( data, texture_addr, (256*256)<<1);
   
      vramRestoreMainBanks( vram_temp);



I tried swiCopy and im getting the result, if I copy only half of the texture then no black lines.

Anyone already had this issue ?

#123200 - DekuTree64 - Mon Mar 26, 2007 2:48 am

You have to wait until VBlank to avoid the black lines. Since you have to take the VRAM banks away from the 3D hardware to transfer things to them, it just renders black instead.
The best way I know of to deal with it is to write a transfer queue system instead of doing the copy directly in the model loader code.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#123203 - tepples - Mon Mar 26, 2007 2:50 am

Have you tried waiting for vblank, copying the first half of the texture data, waiting for another vblank, and copying the second half of the texture data?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#123216 - zeGouky - Mon Mar 26, 2007 8:29 am

Hi,

I'm doing the texture changes right after the swiWaitForVBlank(); but still get the black lines.

I can try to write the texture in 2 half.

#123217 - HyperHacker - Mon Mar 26, 2007 8:45 am

If that works, you might try copying it during HBlank too. More difficult, but you may well pull it off in one frame.
_________________
I'm a PSP hacker now, but I still <3 DS.

#123395 - silent_code - Tue Mar 27, 2007 9:55 pm

can't it be done with interrupts???? i don't have much experience with them, but they somehow came to my mind while reading this. <crazymode>("go away, BAD INTERRUPT, *BAD* INTERRUPT! SIT!")</crazymode>