pub fn with_capacity(target: BufferTarget, usage: BufferUsage, initial_capacity: usize) -> PrimitiveBuffer<T> {
        let mut buffer = 0;
        let bytes = initial_capacity * mem::size_of::<T>();

        unsafe {
            gl::GenBuffers(1, &mut buffer);
            gl::BindBuffer(target as GLenum, buffer);
            gl::BufferData(
                target as GLenum,
                bytes as GLsizeiptr,
                ptr::null(),
                usage as GLenum
            );
        }

        PrimitiveBuffer {
            phantom: PhantomData,

            buffer,
            target,
            usage,
            allocated: initial_capacity,
            primitive_count: 0,
        }
    }
/// Initializes a new, empty, buffer with capacity for the given number of elements of type `T`.
Initializes a new, empty, buffer with capacity for the given number of elements of type `T`.
Initializes a new empty buffer with capacity for the given number of elements of type ` T ` .
pub fn with_capacity(target: BufferTarget, usage: BufferUsage, initial_capacity: usize) -> PrimitiveBuffer<T> {
        let mut buffer = 0;
        let bytes = initial_capacity * mem::size_of::<T>();
        unsafe {
            gl::GenBuffers(1, &mut buffer);
            gl::BindBuffer(target as GLenum, buffer);
            gl::BufferData(
                target as GLenum,
                bytes as GLsizeiptr,
                ptr::null(),
                usage as GLenum
            );
        }
        PrimitiveBuffer {
            phantom: PhantomData,
            buffer,
            target,
            usage,
            allocated: initial_capacity,
            primitive_count: 0,
        }
    }
pub fn with_capacity ( target : BufferTarget , usage : BufferUsage , initial_capacity : usize ) -> PrimitiveBuffer < T > { let mut buffer = 0 ; let bytes = initial_capacity * mem :: size_of :: < T > ( ) ; unsafe { gl :: GenBuffers ( 1 , & mut buffer ) ; gl :: BindBuffer ( target as GLenum , buffer ) ; gl :: BufferData ( target as GLenum , bytes as GLsizeiptr , ptr :: null ( ) , usage as GLenum ) ; } PrimitiveBuffer { phantom : PhantomData , buffer , target , usage , allocated : initial_capacity , primitive_count : 0 , } }
Initializes a new, empty, buffer with capacity for the given number of elements of type `T`.
Initializes a new empty buffer with capacity for the given number of elements of type ` T ` .
target
BufferTarget
usage
BufferUsage
initial_capacity
usize
target
BufferTarget
usage
BufferUsage
initial_capacity
usize