exzbuf(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– exzbuf β€” bestie's guide to Z-buffered polygons πŸ’–

okay so real talk, this is a page out of the Allegro manual, and it's the exzbuf example β€” yes, that's the man page name, it lives in section 3 (library calls, for the uninitiated, iykyk). pull up a chair, grab a boba, we're doing 3D math today. πŸ§‹βœ¨


✨ SYNOPSIS ✨

#include <allegro.h>

Example exzbuf

that's it. that's the whole vibe. one include and a whole demo. slay. πŸ’…


🌈 DESCRIPTION 🌈

so this program is literally a whole tutorial in disguise. it demonstrates how to use Z-buffered polygons plus the floating point 3D math routines, and honestly? it ate. πŸ”₯

it also gives you a simple way to compute fps (that's frames per second, bestie, the number that lives in the corner of every gamer's screen) using a timer. periodt.

here's the plot: first you pick a screen resolution through the standard GUI dialog β€” yes, the classic Allegro one, you know the one πŸŽ€ β€” and then the example hits you with two 3D cubes, rotating, intersecting each other, just doing their little main character thing. 🧊🧊

and the why is the best part, so listen: instead of having full polygons incorrectly overlap other polygons because of per-polygon sorting (the messy, wrong, lowkey embarrassing way), each pixel is drawn at the correct depth. per pixel. correct depth. that's the whole Z-buffer flex. πŸ’š

ngl this is the moment where 3D graphics just clicks for people. the depth thing. you'll see.

πŸ‘€ SEE ALSO πŸ‘€

the full friend group, no one left out, fr fr:

like. the whole roster. go read them, they're all right there. 🫢


and that's the page!! this one's from the Allegro crew, version 4.4.3, and it's filed under exzbuf(3) in section 3 β€” so when you're out here writing your own Z-buffered 3D masterpiece, you know exactly who to thank. πŸ’œβœ¨ bye bestie, go render something gorgeous!! πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from