Struct rin::gl::vao::simple_vao::Builder[][src]

pub struct Builder<'a>(_, _);

Implementations

impl<'a> Builder<'a>[src]

pub fn from_format<T, I>(
    &self,
    format: Format<T, I>
) -> Result<SimpleVao<T>, Error> where
    T: 'static,
    I: Into<Option<Buffer<u32>>>, 
[src]

Create a SimpleVao using a SimpleFormat

#[macro_use] extern crate glin;
use std::mem;
use glin::VertexFormat;

#[derive(VertexFormat)]
struct Vertex{
    position: [f32;3]
}

fn main() {
    let vao = gl.new_simple_vao().from_format(glin::simple_vao::Format{
        buffer: buffer,
        attribute_formats: Vertex::attributes_formats(&program),
        indices: None,
        mode: glin::gl::TRIANGLES,
    }).unwrap();
}

pub fn empty<T>(
    &self,
    attribute_formats: Vec<Format, Global>,
    mode: u32
) -> Result<SimpleVao<T>, Error> where
    T: 'static, 
[src]

Create an emoty SimpleVao from it’s attribute formats and a draw mode

pub fn empty_from_bindings<T>(
    &self,
    bindings: &dyn Bindings,
    mode: u32
) -> Result<SimpleVao<T>, Error> where
    T: 'static + VertexFormat
[src]

Create an empty SimpleVao from a bindings source, usually a glsl program and a draw mode

pub fn from_data_bindings<'data, T, D>(
    &self,
    data: D,
    bindings: &dyn Bindings,
    usage: u32
) -> Result<SimpleVao<T>, Error> where
    T: 'static + VertexFormat,
    D: Into<Data<'data, T>>, 
[src]

Create a SimpleVao from anything that implments Into and a usage mode

This is usually used with other libraries that provide Mesh types that implement Into and not directly

let mesh = ...;  // mesh of type implementing Into<Data>
let vao = glin::SimpleVao::from_data_bindings(mesh, &program, gl::STATIC_DRAW);

but it can be used directly as:

#[macro_use] extern crate glin;
use std::mem;

#[derive(VertexFormat)]
struct Vertex{
    position: [f32;4]
}

fn main() {
    let vertices: Vec<Vertex> = vec![];
    let data = glin::simple_vao::Data{
        vertices: &vertices,
        indices: &[],
        mode: glin::gl::TRIANGLES
    };
    let vao = gl.new_simple_vao().from_data_bindings(data, &program, glin::gl::STATIC_DRAW);
}

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Builder<'a>

impl<'a> !Send for Builder<'a>

impl<'a> !Sync for Builder<'a>

impl<'a> Unpin for Builder<'a>

impl<'a> !UnwindSafe for Builder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]