al_draw_filled_polygon(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’– al_draw_filled_polygon(3) πŸ’–

okay so bestie, welcome to the <allegro_primitives.h> corner of the Library Functions Manual β€” this is the Allegro 5 API primer on filling in shapes, and honestly? it slays. let's get into it πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro_primitives.h>

void al_draw_filled_polygon(const float *vertices, int vertex_count,
   ALLEGRO_COLOR color)

that's the whole vibe right there β€” three little args and you're drawing. πŸ’…


🌸 DESCRIPTION 🌸

okay so this one draws a filled, simple polygon. and "simple" here is doing a LOT of work, so let's be clear about what it means: the polygon does not have to be convex (so no worries, you don't have to be all well-behaved and bulgey), but it must not be self-overlapping. like, at all. self-overlap is not the move, it's giving chaos, it's giving undefined-adjacent behavior energy πŸ’€ β€” so keep your edges from crossing each other, periodt.

your three arguments, bestie:

  • vertices β€” interleaved array of (x, y) vertex coordinates ✨ (yes, interleaved β€” x then y then x then y, do not try to be cute and split them into two arrays, that's not what she asked for)
  • vertex_count β€” number of vertices in the array πŸ”’
  • color β€” color of the filled polygon 🎨

and here's the part you CANNOT skip, iykyk: when the y-axis is facing downwards (which is the usual, the normal situation, the standard vibe), the coordinates must be ordered anti-clockwise. πŸŒ€ not clockwise, not "whatever feels right" β€” anti-clockwise. the winding order is the main character here and you WILL respect her.


⭐ SINCE ⭐

5.1.0 β€” she's been iconic since 5.1.0, no cap 🫢


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the page!! 🌈 go forth and fill your simple, non-self-overlapping, anti-clockwise polygons, bestie, you're gonna eat πŸ”₯

fr fr keep that winding order correct or your shape will simply not be the shape you wanted, and that's on the y-axis facing downwards πŸ™ˆ

al_draw_filled_polygon(3) β€” Allegro reference manual πŸ§šβ€β™€οΈ (the footer's just the manual name, no date on this one, that's all she wrote) πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms