al_draw_prim(3)

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

πŸ’– NAME πŸ’–

okay so bestie, al_draw_prim(3) is the page, and it lives in the Library Functions Manual β€” al_draw_prim is part of the Allegro 5 API. Periodt. πŸ’…

✨ SYNOPSIS ✨

#include <allegro5/allegro_primitives.h>

int al_draw_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl,
                 ALLEGRO_BITMAP* texture, int start, int end, int type)

πŸ¦‹ DESCRIPTION πŸ¦‹

Lowkey it draws a subset of the vertex array you pass in. Vibe check, parameters:

  • texture β€” texture to use, pass NULL to use only color shaded primitves
  • vtxs β€” pointer to an array of vertices
  • decl β€” pointer to a vertex declaration from al_create_vertex_decl(3). If this is NULL, the vertices are assumed to be of the ALLEGRO_VERTEX(3) type
  • start β€” start index of the subset of the vertex array to draw
  • end β€” one past the last index of the subset of the vertex array to draw
  • type β€” a member of the ALLEGRO_PRIM_TYPE(3) enumeration, specifying what kind of primitive to draw

Returns: Number of primitives drawn. 🫢

For example, to draw a textured triangle you could use:

ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1);
ALLEGRO_VERTEX v[] = {
   {.x = 128, .y = 0, .z = 0, .color = white, .u = 128, .v = 0},
   {.x = 0, .y = 256, .z = 0, .color = white, .u = 0, .v = 256},
   {.x = 256, .y = 256, .z = 0, .color = white, .u = 256, .v = 256}};
al_draw_prim(v, NULL, texture, 0, 3, ALLEGRO_PRIM_TRIANGLE_LIST);

🌈 SEE ALSO 🌈

xoxo, the Allegro reference manual πŸ’… signing off from al_draw_prim(3) ✨

πŸ“¦ 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