// function specifically for generating an index buffer
function specifically for generating an index buffer
function specifically for generating an index buffer
fn bind_index_buffer(&mut self, data: &Vec<u32>) {
        // 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::ELEMENT_ARRAY_BUFFER, vbo_id);
            // generates buffer data that opengl can use
            gl::BufferData(
                gl::ELEMENT_ARRAY_BUFFER,
                (data.len() * std::mem::size_of::<f32>()) as gl::types::GLsizeiptr,
                data.as_ptr() as *const gl::types::GLvoid,
                gl::STATIC_DRAW,
            );
        }
        // adds the vbo id to the vaos
        self.vbos.push(vbo_id);
    }
fn bind_index_buffer ( & mut self , data : & Vec < u32 > ) { // 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 :: ELEMENT_ARRAY_BUFFER , vbo_id ) ; // generates buffer data that opengl can use gl :: BufferData ( gl :: ELEMENT_ARRAY_BUFFER , ( data . len ( ) * std :: mem :: size_of :: < f32 > ( ) ) as gl :: types :: GLsizeiptr , data . as_ptr ( ) as * const gl :: types :: GLvoid , gl :: STATIC_DRAW , ) ; } // adds the vbo id to the vaos self . vbos . push ( vbo_id ) ; }
function specifically for generating an index buffer
function specifically for generating an index buffer
&mut self
data
&Vec<u32>