/// This must be called before being dropped to properly free OpenGL
/// resources.
This must be called before being dropped to properly free OpenGL
resources.
This must be called before being dropped to properly free OpenGL resources .
pub fn destroy(&mut self, gl: &Context) {
        if self.is_destroyed {
            return;
        }
        if self.vbo_handle != 0 {
            unsafe { gl.delete_buffer(self.vbo_handle) };
            self.vbo_handle = 0;
        }
        if self.ebo_handle != 0 {
            unsafe { gl.delete_buffer(self.ebo_handle) };
            self.ebo_handle = 0;
        }
        let program = self.shaders.program;
        if program != 0 {
            unsafe { gl.delete_program(program) };
        }
        if self.font_atlas_texture != 0 {
            unsafe { gl.delete_texture(self.font_atlas_texture) };
            self.font_atlas_texture = 0;
        }
        self.is_destroyed = true;
    }
pub fn destroy ( & mut self , gl : & Context ) { if self . is_destroyed { return ; } if self . vbo_handle != 0 { unsafe { gl . delete_buffer ( self . vbo_handle ) } ; self . vbo_handle = 0 ; } if self . ebo_handle != 0 { unsafe { gl . delete_buffer ( self . ebo_handle ) } ; self . ebo_handle = 0 ; } let program = self . shaders . program ; if program != 0 { unsafe { gl . delete_program ( program ) } ; } if self . font_atlas_texture != 0 { unsafe { gl . delete_texture ( self . font_atlas_texture ) } ; self . font_atlas_texture = 0 ; } self . is_destroyed = true ; }
This must be called before being dropped to properly free OpenGL
resources.
This must be called before being dropped to properly free OpenGL resources .
&mut self
gl
&Context