Struct glin::vao::simple_vao::Builder [−][src]
pub struct Builder<'a>(_, _);
Implementations
impl<'a> Builder<'a>
[src]
impl<'a> Builder<'a>
[src]pub fn from_format<T: 'static, I: Into<Option<Buffer<IndexT>>>>(
&self,
format: Format<T, I>
) -> Result<SimpleVao<T>>
[src]
&self,
format: Format<T, I>
) -> Result<SimpleVao<T>>
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: 'static>(
&self,
attribute_formats: Vec<Format>,
mode: GLenum
) -> Result<SimpleVao<T>>
[src]
&self,
attribute_formats: Vec<Format>,
mode: GLenum
) -> Result<SimpleVao<T>>
Create an emoty SimpleVao
from it’s attribute formats and a draw mode
pub fn empty_from_bindings<T>(
&self,
bindings: &dyn Bindings,
mode: GLenum
) -> Result<SimpleVao<T>> where
T: 'static + VertexFormat,
[src]
&self,
bindings: &dyn Bindings,
mode: GLenum
) -> Result<SimpleVao<T>> where
T: 'static + VertexFormat,
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: GLenum
) -> Result<SimpleVao<T>> where
T: 'static + VertexFormat,
D: Into<Data<'data, T>>,
[src]
&self,
data: D,
bindings: &dyn Bindings,
usage: GLenum
) -> Result<SimpleVao<T>> where
T: 'static + VertexFormat,
D: Into<Data<'data, T>>,
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); }