Profile

ALLEGRO_VERTEX_ELEMENT(3alleg5)

ALLEGRO_VERTEX_ELEMENT(3alleg5)

NAME

ALLEGRO_VERTEX_ELEMENT - Allegro 5 API

SYNOPSIS

C]
#include <allegro5/allegro_primitives.h>
typedef struct ALLEGRO_VERTEX_ELEMENT ALLEGRO_VERTEX_ELEMENT;
]

DESCRIPTION

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):

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));
]

I]Fields:]

[bu]
attribute - A member of the ALLEGRO_PRIM_ATTR(3alleg5) enumeration, specifying what this attribute signifies
[bu]
storage - A member of the ALLEGRO_PRIM_STORAGE(3alleg5) enumeration, specifying how this attribute is stored
[bu]
offset - Offset in bytes from the beginning of the custom vertex structure. C function offsetof is very useful here.

SEE ALSO

al_create_vertex_decl(3alleg5), ALLEGRO_VERTEX_DECL(3alleg5), ALLEGRO_PRIM_ATTR(3alleg5), ALLEGRO_PRIM_STORAGE(3alleg5)

Latest Tech News
Your Notes

Sign in/Sign up

Signing in to our system allows you to post your contributions and vote on the contributions of others. It will also allow you to get extra perts like having your favorites in the cloud and having your persistent personal notes wherever you go. More will be added as we scale up our services.

By signing in to our system, you agree our Member Terms and Conditions


Sign-in with one of the following services

Almost finished!

Please select a screen name for NET SOUP.



 Please send me news and special offers from NET SOUP.

 I have read and accept the Terms of Use.

COMPLIMENTARY EXAMPLES

We have no example yet for this entry


Your Name
Now

Community Contributions and Discussions

Modify your search

View Documentation

Jobs from Indeed