// stores a set of data into a VBO of a certain index
stores a set of data into a VBO of a certain index
stores a set of data into a VBO of a certain index
fn store_attb_list_data(&mut self, attribute_num: u32, data: &Vec<f32>, coordinate_size: i32) {
        // creates a new uint for use in generating a vbo
        let mut vbo_id = 0;
        unsafe {
            // creates a new VBO
            gl::GenBuffers(1, &mut vbo_id);
            // binds the newly created VBO
            gl::BindBuffer(gl::ARRAY_BUFFER, vbo_id);
            // generates buffer data that opengl can use
            gl::BufferData(
                gl::ARRAY_BUFFER,
                (data.len() * std::mem::size_of::<f32>()) as gl::types::GLsizeiptr,
                data.as_ptr() as *const gl::types::GLvoid,
                gl::STATIC_DRAW,
            );
            gl::VertexAttribPointer(
                attribute_num,
                coordinate_size,
                gl::FLOAT,
                gl::FALSE,
                0,
                ptr::null()
            );
            // unbinds the buffer
            gl::BindBuffer(gl::ARRAY_BUFFER, 0);
        }
        // adds the vbo id to the vaos
        self.vbos.push(vbo_id);
    }
fn store_attb_list_data ( & mut self , attribute_num : u32 , data : & Vec < f32 > , coordinate_size : i32 ) { // creates a new uint for use in generating a vbo let mut vbo_id = 0 ; unsafe { // creates a new VBO gl :: GenBuffers ( 1 , & mut vbo_id ) ; // binds the newly created VBO gl :: BindBuffer ( gl :: ARRAY_BUFFER , vbo_id ) ; // generates buffer data that opengl can use gl :: BufferData ( gl :: ARRAY_BUFFER , ( data . len ( ) * std :: mem :: size_of :: < f32 > ( ) ) as gl :: types :: GLsizeiptr , data . as_ptr ( ) as * const gl :: types :: GLvoid , gl :: STATIC_DRAW , ) ; gl :: VertexAttribPointer ( attribute_num , coordinate_size , gl :: FLOAT , gl :: FALSE , 0 , ptr :: null ( ) ) ; // unbinds the buffer gl :: BindBuffer ( gl :: ARRAY_BUFFER , 0 ) ; } // adds the vbo id to the vaos self . vbos . push ( vbo_id ) ; }
stores a set of data into a VBO of a certain index
stores a set of data into a VBO of a certain index
&mut self
attribute_num
u32
data
&Vec<f32>
coordinate_size
i32