al_draw_indexed_prim(3alleg5)
β¨ al_draw_indexed_prim β¨
okay bestie, so this is a page from the 3alleg5 manual β that's the Allegro 5 API, and this little function right here is lowkey a whole icon. π
πΈ NAME πΈ
al_draw_indexed_prim β Allegro 5 API, the index-array queen π
π¦ SYNOPSIS π¦
#include <allegro5/allegro_primitives.h>
int al_draw_indexed_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl,
ALLEGRO_BITMAP* texture, const int* indices, int num_vtx, int type)
π DESCRIPTION π
So here's the vibe: you've got a big ol' vertex array, right? But you don't wanna draw all of it β you only want a subset. That's where this function comes in. It draws a subset of the passed vertex array, and it uses an index array to tell it exactly which vertices to grab. It's giving "girl with a list, she knows exactly what she wants." πβ¨
Parameters, let's go one by one:
textureβ the texture to use, bestie. And if you passNULL? Then you're using only color shaded primitves. (yes, that's how the original spells it, and yes, we're keeping it, no cap π)vtxsβ pointer to an array of vertices. Your little vertex collection π«Άdeclβ pointer to a vertex declaration. And if you set it toNULL, thevtxsare assumed to be of theALLEGRO_VERTEXtype. So like, default mode activated π«indicesβ an array of indices into the vertex array. The receipts, the master list, the who's-who πnum_vtxβ number of indices from theindicesarray you want to draw. Not all of them? That's fine, pick your faves πtypeβ a member of theALLEGRO_PRIM_TYPE(3alleg5)enumeration, specifying what kind of primitive to draw. This is the "what are we even making" question π
Returns: the number of primitives drawn. That's your little receipt of how much art you just made. Iconic. π
ngl, this one is genuinely obsessed with efficiency β why redraw vertices when you can just point at them with an index array? it's giving main character energy, fr fr.
π SEE ALSO π
ALLEGRO_VERTEX(3alleg5)πALLEGRO_PRIM_TYPE(3alleg5)π₯ALLEGRO_VERTEX_DECL(3alleg5)β¨al_draw_prim(3alleg5)β the non-indexed sibling, go say hi π
and that's the whole page, bestie!! this one came straight out of the Allegro reference manual, page al_draw_indexed_prim(3alleg5) β go draw something pretty with it, ily, mwah ππ
π
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms