File: ALLEGRO_VERTEX_ELEMENT.3

package info (click to toggle)
allegro5 2%3A5.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,856 kB
  • ctags: 15,948
  • sloc: ansic: 87,540; cpp: 9,693; objc: 3,491; python: 2,057; sh: 829; makefile: 93; perl: 37; pascal: 24
file content (57 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.TH ALLEGRO_VERTEX_ELEMENT 3 "" "Allegro reference manual"
.SH NAME
.PP
ALLEGRO_VERTEX_ELEMENT \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro_primitives.h>

typedef\ struct\ ALLEGRO_VERTEX_ELEMENT\ ALLEGRO_VERTEX_ELEMENT;
\f[]
.fi
.SH DESCRIPTION
.PP
A small structure describing a certain element of a vertex.
E.g.
the position of the vertex, or its color.
These structures are used by the al_create_vertex_decl function to
create the vertex declaration.
For that they generally occur in an array.
The last element of such an array should have the attribute field equal
to 0, to signify that it is the end of the array.
Here is an example code that would create a declaration describing the
ALLEGRO_VERTEX structure (passing this as vertex declaration to
al_draw_prim would be identical to passing NULL):
.IP
.nf
\f[C]
/*\ On\ compilers\ without\ the\ offsetof\ keyword\ you\ need\ to\ obtain\ the
\ *\ offset\ with\ sizeof\ and\ make\ sure\ to\ account\ for\ packing.
\ */
ALLEGRO_VERTEX_ELEMENT\ elems[]\ =\ {
\ \ \ {ALLEGRO_PRIM_POSITION,\ ALLEGRO_PRIM_FLOAT_3,\ offsetof(ALLEGRO_VERTEX,\ x)},
\ \ \ {ALLEGRO_PRIM_TEX_COORD_PIXEL,\ ALLEGRO_PRIM_FLOAT_2,\ offsetof(ALLEGRO_VERTEX,\ u)},
\ \ \ {ALLEGRO_PRIM_COLOR_ATTR,\ 0,\ offsetof(ALLEGRO_VERTEX,\ color)},
\ \ \ {0,\ 0,\ 0}
};
ALLEGRO_VERTEX_DECL*\ decl\ =\ al_create_vertex_decl(elems,\ sizeof(ALLEGRO_VERTEX));
\f[]
.fi
.PP
\f[I]Fields:\f[]
.IP \[bu] 2
attribute \- A member of the ALLEGRO_PRIM_ATTR(3) enumeration,
specifying what this attribute signifies
.IP \[bu] 2
storage \- A member of the ALLEGRO_PRIM_STORAGE(3) enumeration,
specifying how this attribute is stored
.IP \[bu] 2
offset \- Offset in bytes from the beginning of the custom vertex
structure.
C function offsetof is very useful here.
.SH SEE ALSO
.PP
al_create_vertex_decl(3), ALLEGRO_VERTEX_DECL(3), ALLEGRO_PRIM_ATTR(3),
ALLEGRO_PRIM_STORAGE(3)