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.primitive_count;
        self.ensure_allocated(end, !full_override);

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

        unsafe {
            gl::BindBuffer(self.target as GLenum, self.buffer);
            gl::BufferSubData(
                self.target as GLenum,
                (start * mem::size_of::<T>()) as GLintptr,
                (data.len() * mem::size_of::<T>()) as GLsizeiptr,
                mem::transmute(&data[0])
            );
        }
    }
/// Puts the given data 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.
///
/// The index should be in units of the size of `T`. Thus, for a `PrimitiveBuffer<f32>`, a
/// index of `2` will start writing data at the eight byte.
Puts the given data 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.

The index should be in units of the size of `T`. Thus, for a `PrimitiveBuffer`, a
index of `2` will start writing data at the eight byte.
Puts the given data 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 . The index should be in units of the size of ` T ` . Thus for a ` PrimitiveBuffer ` a index of ` 2 ` will start writing data at the eight byte .
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.primitive_count;
        self.ensure_allocated(end, !full_override);
        if end > self.primitive_count {
            self.primitive_count = end;
        }
        unsafe {
            gl::BindBuffer(self.target as GLenum, self.buffer);
            gl::BufferSubData(
                self.target 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 . primitive_count ; self . ensure_allocated ( end , ! full_override ) ; if end > self . primitive_count { self . primitive_count = end ; } unsafe { gl :: BindBuffer ( self . target as GLenum , self . buffer ) ; gl :: BufferSubData ( self . target as GLenum , ( start * mem :: size_of :: < T > ( ) ) as GLintptr , ( data . len ( ) * mem :: size_of :: < T > ( ) ) as GLsizeiptr , mem :: transmute ( & data [ 0 ] ) ) ; } }
Puts the given data at the given index in this buffer, overwriting any
vertices which where previously in that location.
Puts the given data 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]