Struct rin::gl::Vao [−][src]
pub struct Vao { /* fields omitted */ }
A wrapper for an OpenGL VAO
VAO
Uses the DSA model for creating vertex array objects and binding attributes to it.
Internally it uses the types in the attributes module to bind buffers to the different attributes.
VAO
binds buffers to vertex buffer binding points using VertexBufferBindingT
and allows
to specify a divisor for each of those bindings.
Then binds attributes by their location and format to one of the previously specified binding points
This allows to specify a relation 1:N 1:N between buffers -> binding points <- attributes
Where a buffer can be bound to 1 or more binding points and one or more attributes can read
from one binding point. See the attributes
module for more specifics about how this is
implemented
A VAO
can also optionally include an indices buffer.
A VAO
takes ownership of the buffers it binds to binding points. In order to bind a buffer
in several VAO
you can use a SharedBuffer or a reference to a Buffer.
Implementations
impl Vao
[src]
impl Vao
[src]pub fn id(&self) -> u32
[src]
pub fn len(&self) -> usize
[src]
Returns the number of vertices of the VAO
Calculated as the max len of all the underlying vertex buffers
pub fn is_empty(&self) -> bool
[src]
Returns true all the internal vertex buffers are empty
pub fn range<R>(&self, range: R, mode: u32) -> Range<'_> where
R: InputRange,
[src]
R: InputRange,
Returns a Range
which specifies a range of vertices and a drawing mode
Used to draw a portion of a VAO
through a Context
pub fn range_base_vertex<R>(
&self,
range: R,
base_vertex: i32,
mode: u32
) -> Range<'_> where
R: InputRange,
[src]
&self,
range: R,
base_vertex: i32,
mode: u32
) -> Range<'_> where
R: InputRange,
Returns a Range
which specifies a range of vertices and a drawing mode
Used to draw a portion of a VAO
through a Context
base_vertex adds an offset to the indices
See glDrawElementsBaseVertex
pub fn range_base_instance<R>(
&self,
range: R,
base_instance: u32,
mode: u32
) -> Range<'_> where
R: InputRange,
[src]
&self,
range: R,
base_instance: u32,
mode: u32
) -> Range<'_> where
R: InputRange,
Returns a Range
which specifies a range of vertices and a drawing mode
Used to draw a portion of a VAO
through a Context
base_instance adds an offset to the instanced attributes
index
See glDrawArraysInstancedBaseInstance
pub fn range_base_vertex_base_instance<R>(
&self,
range: R,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> Range<'_> where
R: InputRange,
[src]
&self,
range: R,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> Range<'_> where
R: InputRange,
Returns a Range
which specifies a range of vertices and a drawing mode
Used to draw a portion of a VAO
through a Context
- base_vertex adds an offset to the indices
- base_instance adds an offset to the instanced attributes index
See glDrawElementsBaseVertexBaseInstance
pub fn full_range(&self, mode: u32) -> Range<'_>
[src]
Returns the full range of the Vao
vertices
Used to draw the full VAO
through a Context
pub fn full_range_base_vertex(&self, base_vertex: i32, mode: u32) -> Range<'_>
[src]
Returns the full range of the Vao
vertices
Used to draw the full VAO
through a Context
base_vertex adds an offset to the indices
See glDrawElementsBaseVertex
pub fn full_range_base_instance(
&self,
base_instance: u32,
mode: u32
) -> Range<'_>
[src]
&self,
base_instance: u32,
mode: u32
) -> Range<'_>
Returns the full range of the Vao
vertices
Used to draw the full VAO
through a Context
base_instance adds an offset to the instanced attributes
index
See glDrawArraysInstancedBaseInstance
pub fn full_range_base_vertex_base_instance(
&self,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> Range<'_>
[src]
&self,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> Range<'_>
Returns the full range of the Vao
vertices
Used to draw the full VAO
through a Context
- base_vertex adds an offset to the indices
- base_instance adds an offset to the instanced attributes index
See glDrawElementsBaseVertexBaseInstance
pub fn into_range<R>(self, range: R, mode: u32) -> IntoRange where
R: InputRange,
[src]
R: InputRange,
Consumes the Vao into a range
pub fn into_range_base_vertex<R>(
self,
range: R,
base_vertex: i32,
mode: u32
) -> IntoRange where
R: InputRange,
[src]
self,
range: R,
base_vertex: i32,
mode: u32
) -> IntoRange where
R: InputRange,
Consumes the Vao into a range
base_vertex adds an offset to the indices See glDrawElementsBaseVertex
pub fn into_range_base_instance<R>(
self,
range: R,
base_instance: u32,
mode: u32
) -> IntoRange where
R: InputRange,
[src]
self,
range: R,
base_instance: u32,
mode: u32
) -> IntoRange where
R: InputRange,
Consumes the Vao into a range
base_instance adds an offset to the instanced attributes index See glDrawArraysInstancedBaseInstance
pub fn into_range_base_vertex_base_instance<R>(
self,
range: R,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> IntoRange where
R: InputRange,
[src]
self,
range: R,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> IntoRange where
R: InputRange,
Consumes the Vao into a range
- base_vertex adds an offset to the indices
- base_instance adds an offset to the instanced attributes index
See glDrawElementsBaseVertexBaseInstance
pub fn into_full_range(self, mode: u32) -> IntoRange
[src]
Consumes the VAO into it’s full range
pub fn into_full_range_base_vertex(
self,
base_vertex: i32,
mode: u32
) -> IntoRange
[src]
self,
base_vertex: i32,
mode: u32
) -> IntoRange
Consumes the VAO into it’s full range
base_vertex adds an offset to the indices See glDrawElementsBaseVertex
pub fn into_full_range_base_instance(
self,
base_instance: u32,
mode: u32
) -> IntoRange
[src]
self,
base_instance: u32,
mode: u32
) -> IntoRange
Consumes the VAO into it’s full range
base_instance adds an offset to the instanced attributes index See glDrawArraysInstancedBaseInstance
pub fn into_full_range_base_vertex_base_instance(
self,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> IntoRange
[src]
self,
base_vertex: i32,
base_instance: u32,
mode: u32
) -> IntoRange
Consumes the VAO into it’s full range
- base_vertex adds an offset to the indices
- base_instance adds an offset to the instanced attributes index
See glDrawElementsBaseVertexBaseInstance
pub fn enable(&mut self, attr_name: &str) -> Result<(), Error>
[src]
Enable an attribute by name
pub fn disable(&mut self, attr_name: &str) -> Result<(), Error>
[src]
Disable an attribute by name
pub fn enable_indices(&mut self)
[src]
Enable the indices in the VAO
pub fn disable_indices(&mut self)
[src]
Disable the indices in the VAO
pub fn buffer<T, B>(&self, index: usize) -> Option<&B> where
B: 'static + BufferRange<T>,
T: 'static,
[src]
B: 'static + BufferRange<T>,
T: 'static,
Reference to an internal buffer by it’s index and type
pub fn buffer_mut<T, B>(&mut self, index: usize) -> Option<&mut B> where
B: 'static + BufferRange<T>,
T: 'static,
[src]
B: 'static + BufferRange<T>,
T: 'static,
Mutable reference to an internal buffer by it’s index and type
pub fn indices_buffer<B>(&self) -> Option<&B> where
B: 'static + BufferRangeMut<u32>,
[src]
B: 'static + BufferRangeMut<u32>,
Reference to the indices buffer by it’s index and type
pub fn indices_buffer_mut<B>(&mut self) -> Option<&mut B> where
B: 'static + BufferRangeMut<u32>,
[src]
B: 'static + BufferRangeMut<u32>,
Mutable reference to the indices buffer by it’s index and type
pub fn set_indices_buffer<B>(&mut self, buffer: B) where
B: 'static + BufferRangeMut<u32>,
[src]
B: 'static + BufferRangeMut<u32>,
pub fn set_attributes_buffer<T, B, I>(
&mut self,
formats: I,
buffer: B
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
I: Into<Vec<Format, Global>>,
[src]
&mut self,
formats: I,
buffer: B
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
I: Into<Vec<Format, Global>>,
pub fn set_instance_attributes_buffer<T, B, I>(
&mut self,
formats: I,
buffer: B,
divisor: usize
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
I: Into<Vec<Format, Global>>,
[src]
&mut self,
formats: I,
buffer: B,
divisor: usize
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
I: Into<Vec<Format, Global>>,
pub fn set_attribute_buffer_at<T, B>(
&mut self,
index: usize,
buffer: B
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
[src]
&mut self,
index: usize,
buffer: B
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
pub fn set_instance_attribute_buffer_at<T, B>(
&mut self,
index: usize,
buffer: B,
divisor: usize
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
[src]
&mut self,
index: usize,
buffer: B,
divisor: usize
) -> Result<(), Error> where
B: BufferRange<T> + 'static,
T: 'static,
Trait Implementations
impl<'a> VaoRange for &'a Vao
[src]
impl<'a> VaoRange for &'a Vao
[src]pub fn id(&self) -> u32
[src]
pub fn start(&self) -> usize
[src]
pub fn end(&self) -> usize
[src]
pub fn count(&self) -> usize
[src]
pub fn num_indices(&self) -> usize
[src]
pub fn num_vertices(&self) -> usize
[src]
pub fn has_indices(&self) -> bool
[src]
pub fn base_vertex(&self) -> Option<i32>
[src]
pub fn base_instance(&self) -> Option<u32>
[src]
impl Eq for Vao
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Vao
impl !Send for Vao
impl !Sync for Vao
impl Unpin for Vao
impl !UnwindSafe for Vao
Blanket Implementations
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]