1al_draw_prim(3)                                                al_draw_prim(3)
2
3
4

NAME

6       al_draw_prim - Allegro 5 API
7

SYNOPSIS

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

DESCRIPTION

15       Draws a subset of the passed vertex array.
16
17       Parameters:
18
19       • texture  -  Texture  to use, pass NULL to use only color shaded prim‐
20         itves
21
22       • vtxs - Pointer to an array of vertices
23
24       • decl - Pointer to a [vertex declaration]al_create_vertex_decl(3).  If
25         set  to NULL, the vertices are assumed to be of the ALLEGRO_VERTEX(3)
26         type
27
28       • start - Start index of the subset of the vertex array to draw
29
30       • end - One past the last index of the subset of the  vertex  array  to
31         draw
32
33       • type  -  A member of the ALLEGRO_PRIM_TYPE(3) enumeration, specifying
34         what kind of primitive to draw
35
36       Returns: Number of primitives drawn
37
38       For example to draw a textured triangle you could use:
39
40              ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1);
41              ALLEGRO_VERTEX v[] = {
42                 {.x = 128, .y = 0, .z = 0, .color = white, .u = 128, .v = 0},
43                 {.x = 0, .y = 256, .z = 0, .color = white, .u = 0, .v = 256},
44                 {.x = 256, .y = 256, .z = 0, .color = white, .u = 256, .v = 256}};
45              al_draw_prim(v, NULL, texture, 0, 3, ALLEGRO_PRIM_TRIANGLE_LIST);
46

SEE ALSO

48       ALLEGRO_VERTEX(3),    ALLEGRO_PRIM_TYPE(3),     ALLEGRO_VERTEX_DECL(3),
49       al_draw_indexed_prim(3)
50
51
52
53Allegro reference manual                                       al_draw_prim(3)
Impressum