pub fn with_capacity(primitive_mode: PrimitiveMode, usage: BufferUsage, initial_capacity: usize) -> VertexBuffer<T> {
        let mut buffer = VertexBuffer::new(primitive_mode, usage);
        let bytes = mem::size_of::<T>() * initial_capacity;

        unsafe {
            gl::GenBuffers(1, &mut buffer.vbo);
            gl::BindBuffer(BufferTarget::Array as GLenum, buffer.vbo);
            gl::BufferData(BufferTarget::Array as GLenum, bytes as GLsizeiptr, ptr::null(), usage as GLenum);

            gl::BindVertexArray(buffer.vao);
            T::setup_attrib_pointers(0);
        }

        buffer.vertex_count = 0;
        buffer.allocated = initial_capacity;

        return buffer;
    }
/// Creates a new vertex buffer, preallocating space for the given number of vertices.
Creates a new vertex buffer, preallocating space for the given number of vertices.
Creates a new vertex buffer preallocating space for the given number of vertices .
pub fn with_capacity(primitive_mode: PrimitiveMode, usage: BufferUsage, initial_capacity: usize) -> VertexBuffer<T> {
        let mut buffer = VertexBuffer::new(primitive_mode, usage);
        let bytes = mem::size_of::<T>() * initial_capacity;
        unsafe {
            gl::GenBuffers(1, &mut buffer.vbo);
            gl::BindBuffer(BufferTarget::Array as GLenum, buffer.vbo);
            gl::BufferData(BufferTarget::Array as GLenum, bytes as GLsizeiptr, ptr::null(), usage as GLenum);
            gl::BindVertexArray(buffer.vao);
            T::setup_attrib_pointers(0);
        }
        buffer.vertex_count = 0;
        buffer.allocated = initial_capacity;
        return buffer;
    }
pub fn with_capacity ( primitive_mode : PrimitiveMode , usage : BufferUsage , initial_capacity : usize ) -> VertexBuffer < T > { let mut buffer = VertexBuffer :: new ( primitive_mode , usage ) ; let bytes = mem :: size_of :: < T > ( ) * initial_capacity ; unsafe { gl :: GenBuffers ( 1 , & mut buffer . vbo ) ; gl :: BindBuffer ( BufferTarget :: Array as GLenum , buffer . vbo ) ; gl :: BufferData ( BufferTarget :: Array as GLenum , bytes as GLsizeiptr , ptr :: null ( ) , usage as GLenum ) ; gl :: BindVertexArray ( buffer . vao ) ; T :: setup_attrib_pointers ( 0 ) ; } buffer . vertex_count = 0 ; buffer . allocated = initial_capacity ; return buffer ; }
Creates a new vertex buffer, preallocating space for the given number of vertices.
Creates a new vertex buffer preallocating space for the given number of vertices .
primitive_mode
PrimitiveMode
usage
BufferUsage
initial_capacity
usize
primitive_mode
PrimitiveMode
usage
BufferUsage
initial_capacity
usize