1al_draw_prim(3) Library Functions Manual al_draw_prim(3)
2
3
4
6 al_draw_prim
7
9 #include <allegro5/allegro_primitives.h>
10
11 int al_draw_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl,
12 ALLEGRO_BITMAP* texture, int start, int end, int type)
13
15 Draws a subset of the passed vertex buffer.
16
17 Parameters:
18
19 · texture - Texture to use, pass 0 to use only color shaded primitves
20
21 · vtxs - Pointer to an array of vertices
22
23 · decl - Pointer to a vertex declaration. If set to NULL, the vertices
24 are assumed to be of the ALLEGRO_VERTEX type
25
26 · start - Start index of the subset of the vertex buffer to draw
27
28 · end - One past the last index of subset of the vertex buffer to draw
29
30 · type - Primitive type to draw
31
32 Returns: Number of primitives drawn
33
34 For example to draw a textured triangle you could use:
35
36 ALLEGRO_VERTEX v[] = {
37 {.x = 128, .y = 0, .z = 0, .u = 128, .v = 0},
38 {.x = 0, .y = 256, .z = 0, .u = 0, .v = 256},
39 {.x = 256, .y = 256, .z = 0, .u = 256, .v = 256}};
40 al_draw_prim(v, NULL, texture, 0, 3, ALLEGRO_PRIM_TRIANGLE_LIST);
41
43 ALLEGRO_VERTEX(3), ALLEGRO_PRIM_TYPE(3), ALLEGRO_VERTEX_DECL(3),
44 al_draw_indexed_prim(3)
45
46
47
48Allegro reference manual al_draw_prim(3)