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 > using POLY_ALPHA

#167524 - Echo49 - Tue Mar 17, 2009 10:45 am

I'm using a 2D over 3D engine for my game and am using glPolyFmt(POLY_ALPHA(alpha)); to set the transparency of my sprites. However, when two sprites with different alpha are on top of each other, they are not rendered on top of each other; instead, one of them will jump to the top seemingly regardless of its z-value (I didn't test this in depth), while the parts of the second one covered by the first one are not rendered.

Is this able to be fixed?

#167527 - elhobbs - Tue Mar 17, 2009 2:01 pm

I had a similiar issue in cquake when rendering the layered sky. in my situation the issue was related to the parameter passed to glFlush. I tried glFlush(0) and glFlush(2). I forget which one was which but one would not z-sort correctly and the other one would cause issues with polygons that were close together along the same plane - it looked like a precision issue as the artifacts would decrease the closer the object got to the viewpoint.

#167546 - Echo49 - Tue Mar 17, 2009 11:52 pm

I seem to have fixed this by assigning each sprite (ie. 2d square with texture) a different polygon id.

Code:
u32 polygonId = 0;

//...

if (++polygonId > 63)
    polygonId = 0;