[AD] depth buffer API

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


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,

	/* 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};

Anything else that would be required for the most common uses of the
depth buffer?

This is of course just the OpenGL depth buffer API so implementation
is trivial for both function. (But just like with clipping, depth buffer
state would be kept per target bitmap.)

I haven't checked yet but I suppose it should be equally simple to
implement in DirectX.




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