pub struct IndexBuffer {
pub id: u32,
}
Expand description
A abstract representation of a index buffer
§Example
let indices = vec![
0, 1, 3, // first Triangle
1, 2, 3, // second Triangle
];
// static
let ibo1 = VertexBuffer::new(calc_bytes_size(&indices) as isize, Some(&vertices));
// Dynamic
let ibo2 = VertexBuffer::new(calc_bytes_size(&indices) as isize);
// send half of the vertices
ibo2.send_data(24 / 2, 0, &indices);
Fields§
§id: u32
Implementations§
Source§impl IndexBuffer
impl IndexBuffer
Sourcepub fn new(size: isize, indices: Option<&Vec<i32>>) -> Self
pub fn new(size: isize, indices: Option<&Vec<i32>>) -> Self
Return a IndexBuffer with the allocated size provided, the buffer data is static only if the indices isn’t None, else, the buffer data is dynamic
§Arguments
size
- The size in bytes of the data to allocateindices
- A optional data to write
Sourcepub fn send_data(&self, size: isize, offset: isize, indices: &Vec<i32>)
pub fn send_data(&self, size: isize, offset: isize, indices: &Vec<i32>)
Write data that wasn’t provided on the new function
§Arguments
size
- The size in bytes of the data to writeoffset
- Point to a offset in the allocated spaceindices
- Data to write
pub fn bind(&self)
pub fn unbind(&self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexBuffer
impl RefUnwindSafe for IndexBuffer
impl Send for IndexBuffer
impl Sync for IndexBuffer
impl Unpin for IndexBuffer
impl UnwindSafe for IndexBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more