Re: [AD] depth buffer API |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 6 May 2012 00:54:04 +0200, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> Too lazy to search for previous discussions about this, but would the
> following API addition make sense?
>
> /* Clears the depth buffer to the specified value. */
>
> void al_clear_depth_buffer(float x);
>
> void al_set_depth_buffer(
> ALLEGRO_DEPTHFUNC function,
> ALLEGRO_DEPTH_BUFFER_FLAGS flags);
>
> /* Determines how the depth value of new pixels is compared to
> existing depth values in the depth buffer. */
>
> enum ALLEGRO_DEPTHFUNC {
> ALLEGRO_DEPTHFUNC_NEVER,
> ALLEGRO_DEPTHFUNC_ALWAYS,
> ALLEGRO_DEPTHFUNC_LESS,
> ALLEGRO_DEPTHFUNC_EQUAL,
> ALLEGRO_DEPTHFUNC_LESS_EQUAL,
> ALLEGRO_DEPTHFUNC_GREATER,
> ALLEGRO_DEPTHFUNC_NOT_EQUAL,
> ALLEGRO_DEPTHFUNC_GREATER_EQUAL};
>
> enum ALLEGRO_DEPTH_BUFFER_FLAGS {
>
> /* If this flag is not set no depth testing is done. */
>
> ALLEGRO_DEPTH_CHECK = 1,
I suggest ALLEGRO_DEPTH_TEST.
>
> /* If this flag is not set the depth buffer is not updated. */
>
> 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.
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.
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)?
Peter