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 > Translucent box / Solid box problem (SOLVED)

#130820 - a128 - Fri Jun 08, 2007 2:07 pm

I draw two boxes

One box is translucent , the box behind is solid, flad shaded box

The Problem i can not see solid box THRU the translucent box. The translucent box is in fact translucent and in front of the solid box.

BTW the Solid box does not have any GFX_NORMAL commands, because it's a flat shaded box. So I do not turn POLY_FORMAT_LIGHT0 on

The code below just reflects the parameters for the translucent/solid part
I use

Code:


#define POLY_FORMAT_LIGHTFLAGS (flags for 1 light or more)
 //Bit15 is 1 !!!!!
 GFX_DIFFUSE_AMBIENT = 0x18c6f1fc;
 GFX_SPECULAR_EMISSION = 0x18c6;
//Solid Box
 glPolyFmt(POLY_ID(0) | POLY_ALPHA(31) | POLY_CULL_BACK| 0);
glBegin(GL_QUADS);
 ....


//Translucent Box
/*setMaterial0()*/
 GFX_DIFFUSE_AMBIENT = 0x18c6ffff;
 GFX_SPECULAR_EMISSION = 0x18c6;
/* translucent level 10 */
 glPolyFmt(POLY_ID(1) | POLY_ALPHA(10) | POLY_CULL_NONE| POLY_FORMAT_LIGHTFLAGS);
glBegin(GL_QUADS);


....

glFlush(0); //Is this automaic sorting?! or glFlush(1)?!


Last edited by a128 on Mon Jun 11, 2007 3:26 pm; edited 1 time in total

#130825 - kalus - Fri Jun 08, 2007 3:35 pm

sounds like an alpha sorting issue. i think you might need normal data setting for the ds to determine render order

#130830 - a128 - Fri Jun 08, 2007 4:21 pm

I found the solution:

You must enable once

Code:
   
glEnable(GL_BLEND);
glAlphaFunc(BLEND_ALPHA);


then the above code works just fine.