Re: [AD] depth buffer API

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 6 May 2012 10:17:48 +1000
Peter Wang <novalazy@xxxxxxxxxx> wrote:
> > 
> > 	ALLEGRO_DEPTH_WRITE = 2,
> > 
> > 	/* If this flag is set the color buffer is not updated. */
> > 
> > 	ALLEGRO_NO_COLOR_WRITE = 4};
> 
> Not another NO flag.  But I don't think this belongs with the depth
> buffer API.

Hm, yeah, I know... I previously made a patch for an
al_set_color_mask(bool red, green, blue, alpha) function but never
commited it... and I didn't want too many new functions when a bit flag
is enough. In OpenGL it's:

glEnable(GL_DEPTH_TEST);
glColorMask(r, g, b, a);
glDepthMask(on_off);

> 
> Is the only way to make use of the depth buffer from pure Allegro code
> the primitives addon?  I guess we would need to document the z values
> for al_draw_bitmap, etc. and the font addons.

I suppose. My use case actually is al_draw_bitmap only. I clear the
z-buffer to 1 then any non-transparent pixels of al_draw_bitmap cause
it to be set to 0. With GL_LESS that means any sub-sequent overlapping
parts of bitmaps are masked away. And by enabling/disabling the
depth/color buffers I can modify the mask independently.

> 
> Since the depth buffer state is per target bitmap, al_set_depth_buffer
> would just fail for memory bitmaps (except when the arguments are
> trivial)?
> 

Ah, yes, the software drawers would not support it of course. And we
may want to add some API to attach an off-screen depth buffer to a
bitmap as right now al_set_target_bitmap means there will be no depth
buffer.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/