al_clear_depth_buffer(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_clear_depth_buffer β€” the Allegro 5 API page, bestie edition πŸ’–

okay so this is al_clear_depth_buffer from the Allegro 5 API, manual section 3alleg5 if you're keeping score. it's giving "tiny function, big responsibility." let's get into it 🫢


✨ NAME ✨

al_clear_depth_buffer β€” Allegro 5 API

that's it. that's the name. short, sweet, iconic.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro5/allegro.h>

void al_clear_depth_buffer(float z)

so you include the big one, <allegro5/allegro.h>, and then you've got void al_clear_depth_buffer(float z) β€” returns nothing, takes one float z, no drama. πŸ’…


🌸 DESCRIPTION 🌸

okay so what does it do? it clears the depth buffer, and it's confined by the clipping rectangle, and it sets it to the value you pass in. that's the whole vibe.

bestie. listen. 🚨 a depth buffer only exists if you actually asked for it β€” you gotta request it with al_set_new_display_option(3alleg5) and the requirement has to have actually been met by the al_create_display(3alleg5) call that created your current display. if either of those didn't happen, no depth buffer for you, no cap. 😭

also, anything touching the depth buffer is affected by al_set_render_state(3alleg5) β€” so don't forget that knob exists.

for example (and this one is genuinely useful, not me just talking): if ALLEGRO_DEPTH_FUNCTION is set to ALLEGRO_RENDER_LESS, then a depth buffer value of 1 represents infinite distance. so like, 1 is a good value to use when you're clearing the depth buffer. queen behavior. πŸ‘‘


⭐ SINCE ⭐

5.1.2 β€” been here since 5.1.2, a real veteran πŸ’œ


πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, they're all in the friend group 🫢


and that's the page!! brought to you by the Allegro reference manual, section al_clear_depth_buffer(3alleg5) β€” mwah, go clear some buffers, bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from