[][src]Macro glium::implement_vertex

macro_rules! implement_vertex {
    ($struct_name:ident, $($field_name:ident),+) => { ... };
    ($struct_name:ident, $($field_name:ident normalize($should_normalize:expr)),+) => { ... };
    ($struct_name:ident, $($field_name:ident),+,) => { ... };
}

Implements the glium::vertex::Vertex trait for the given type.

The parameters must be the name of the struct and the names of its fields.

Safety

You must not use this macro on any struct with fields that cannot be zeroed.

Example

#[derive(Copy, Clone)]
struct Vertex {
    position: [f32; 3],
    tex_coords: [f32; 2],
}

implement_vertex!(Vertex, position, tex_coords);

Naming convention

When it comes to using to using your vertex array in a shader you must make sure that all your attribute variables match the field names in the struct you are calling calling this macro for.

So, if you have a vertex_position atribute/input in your shader, a field named vertex_position must be present in the struct. Ohterwise the drawing functions will panic.