al_draw_indexed_buffer(3alleg5)

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

al_draw_indexed_buffer πŸ’…βœ¨

okay bestie, welcome to the Allegro 5 API β€” this one's from the allegro_primitives corner of the world, and it's lowkey iconic once you get it. let's go 🫢


✨ SYNOPSIS ✨

#include <allegro5/allegro_primitives.h>

int al_draw_indexed_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer,
   ALLEGRO_BITMAP* texture, ALLEGRO_INDEX_BUFFER* index_buffer,
   int start, int end, int type)

🌸 DESCRIPTION 🌸

So what this does is it draws a subset of the vertex buffer you hand it β€” not the whole thing, just a lil slice. And the way it knows which vertices to actually use? An index buffer, bestie. That's the whole trick. πŸ‘‘

Both buffers must not be locked. Not negotiable, fr fr.

And here's the tea: if you wanna draw onto memory bitmaps or use memory bitmap textures, then both buffers have to support reading. Which means they gotta be created with ALLEGRO_PRIM_BUFFER_READWRITE. No exceptions, periodt. πŸ’€

πŸŽ€ Parameters πŸŽ€

  • vertex_buffer β€” the vertex buffer you're drawing. your main character. ✨
  • texture β€” the texture to use. pass NULL if you only want color-shaded primitives (i.e. no texture at all, just vibes). 🌈
  • index_buffer β€” the index buffer to use. this is the one picking the vertices. πŸ’…
  • start β€” the start index of the subset of the index buffer you're drawing. where the slay begins. πŸ¦‹
  • end β€” one past the last index of the subset of the index buffer to draw. yes, one past β€” classic C-style half-open thing, don't come for me. πŸ™ˆ
  • type β€” a member of the ALLEGRO_PRIM_TYPE(3alleg5) enumeration, specifying what kind of primitive to draw. ⭐
⚠️ heads up babes: ALLEGRO_PRIM_LINE_LOOP and ALLEGRO_PRIM_POINT_LIST are not supported. not happening. pick something else. πŸ’€

Returns: Number of primitives drawn πŸ”₯


πŸ’– SINCE πŸ’–

5.1.8


🧚 SEE ALSO 🧚


and that's the whole page, bestie β€” straight from the Allegro reference manual, covering al_draw_indexed_buffer(3alleg5). go draw something gorgeous with it. mwah πŸ’‹πŸŒΈπŸ’œ

πŸ“¦ where this page comes from