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 > GL_CLEAR_BMP. problem with the depth plane [solved]

#140081 - nce - Thu Sep 13, 2007 12:45 pm

Hi,

I was trying to use the GL_CLEAR_BMP that allow you to set a bitmap and a depth map to clean the screen in 3D...

But while I succeed to set a bitmap, I'm not able to draw anything else... I guess it's because of the depth function.

Code:

   glInit();

   videoSetMode(MODE_0_3D | DISPLAY_SPR_ACTIVE | 
                      DISPLAY_BG0_ACTIVE |
                      DISPLAY_SPR_1D |
                      DISPLAY_SPR_1D_SIZE_64 );


   videoSetModeSub(MODE_0_2D | DISPLAY_SPR_ACTIVE |
                        DISPLAY_SPR_1D |
                        DISPLAY_SPR_1D_SIZE_32 );

   glViewPort(0,0,255,191);
   
   glClearColor(0,0,0,31);
   glClearDepth(0x7FFF);

//activate the clear bmp
   GFX_CONTROL |= GL_CLEAR_BMP;


   
   vramSetBankA(VRAM_A_TEXTURE);
   vramSetBankB(VRAM_B_TEXTURE);
   vramSetBankC(VRAM_C_TEXTURE);
   vramSetBankD(VRAM_D_TEXTURE);
   vramSetBankE(VRAM_E_MAIN_SPRITE);
   vramSetBankF(VRAM_F_TEX_PALETTE);
   vramSetBankI(VRAM_I_SUB_SPRITE);

//.....

   vramSetBankC(VRAM_C_LCD);
   vramSetBankC(VRAM_D_LCD);

//setting a stupid color for testing
   int i = 0;
   u16* ptr = VRAM_C;
   for ( i = 0 ; i < 256*256 ; i++ )
   {
      *ptr++ = RGB15 ( 15,0,31 )|(1<<15);
   }

//setting depth by default
   ptr = VRAM_D;
   for ( i = 0 ; i < 256*256 ; i++ )
   {
      *ptr++ = 0x7FFF;
   }
   

   vramSetBankC(VRAM_C_TEXTURE);
   vramSetBankD(VRAM_D_TEXTURE);


Does anyone has already try to work with this ?

I realy don't have any idea what's wrong here, maybe I need to set something else ?

Also if I don't set the alpha bit in the color, the screen stay black but I just have one half line in the middle with some garbage color....
I also tryied to set the depth to 0 ( maybe it's map in the other order ) but no change

Anyone has an idea ?

Thanks
_________________
-jerome-


Last edited by nce on Thu Sep 13, 2007 12:52 pm; edited 1 time in total

#140082 - nce - Thu Sep 13, 2007 12:51 pm

OOOOOOOH I can be reaaaaaaaly stupid sometimes.....

bad copy-paste here ;)

vramSetBankC(VRAM_C_LCD);
vramSetBankC(VRAM_D_LCD);

the error was there... thanks to the forum while I was reading my post I noticed my mistake ... ( when reading my source I seen this line 100 times without notice, but move it form your editor and it becomes visible LOL )

Thanks anyway ;)
_________________
-jerome-