pub fn put(&mut self, index: usize, data: &[T]) {
        if data.is_empty() {
            return;
        }

        let start = index;
        let end = index + data.len();

        let full_override = start == 0 && end >= self.vertex_count;
        self.ensure_allocated(end, !full_override);

        if end > self.vertex_count {
            self.vertex_count = end;
        }

        unsafe {
            gl::BindBuffer(BufferTarget::Array as GLenum, self.vbo);
            gl::BufferSubData(
                BufferTarget::Array as GLenum,
                (start * mem::size_of::<T>()) as GLintptr,
                (data.len() * mem::size_of::<T>()) as GLsizeiptr,
                mem::transmute(&data[0])
            );
        }
    }
/// Puts the given vertices at the given index in this buffer, overwriting any
/// vertices which where previously in that location. This resizes the underlying
/// buffer if more space is needed to store the new data.
Puts the given vertices at the given index in this buffer, overwriting any
vertices which where previously in that location. This resizes the underlying
buffer if more space is needed to store the new data.
Puts the given vertices at the given index in this buffer overwriting any vertices which where previously in that location . This resizes the underlying buffer if more space is needed to store the new data .
pub fn put(&mut self, index: usize, data: &[T]) {
        if data.is_empty() {
            return;
        }
        let start = index;
        let end = index + data.len();
        let full_override = start == 0 && end >= self.vertex_count;
        self.ensure_allocated(end, !full_override);
        if end > self.vertex_count {
            self.vertex_count = end;
        }
        unsafe {
            gl::BindBuffer(BufferTarget::Array as GLenum, self.vbo);
            gl::BufferSubData(
                BufferTarget::Array as GLenum,
                (start * mem::size_of::<T>()) as GLintptr,
                (data.len() * mem::size_of::<T>()) as GLsizeiptr,
                mem::transmute(&data[0])
            );
        }
    }
pub fn put ( & mut self , index : usize , data : & [ T ] ) { if data . is_empty ( ) { return ; } let start = index ; let end = index + data . len ( ) ; let full_override = start == 0 && end >= self . vertex_count ; self . ensure_allocated ( end , ! full_override ) ; if end > self . vertex_count { self . vertex_count = end ; } unsafe { gl :: BindBuffer ( BufferTarget :: Array as GLenum , self . vbo ) ; gl :: BufferSubData ( BufferTarget :: Array as GLenum , ( start * mem :: size_of :: < T > ( ) ) as GLintptr , ( data . len ( ) * mem :: size_of :: < T > ( ) ) as GLsizeiptr , mem :: transmute ( & data [ 0 ] ) ) ; } }
Puts the given vertices at the given index in this buffer, overwriting any
vertices which where previously in that location.
Puts the given vertices at the given index in this buffer overwriting any vertices which where previously in that location .
&mut self
index
usize
data
&[T]
&mut self
index
usize
data
&[T]