al_draw_prim(3)
π 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, passNULLto use only color shaded primitvesvtxsβ pointer to an array of verticesdeclβ pointer to a vertex declaration fromal_create_vertex_decl(3). If this isNULL, the vertices are assumed to be of theALLEGRO_VERTEX(3)typestartβ start index of the subset of the vertex array to drawendβ one past the last index of the subset of the vertex array to drawtypeβ a member of theALLEGRO_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