Merge pull request #1181 from feylinara/feylinara/issue1087

Fix memory leak in opengl integration example
This commit is contained in:
Héctor Ramón 2022-01-03 12:03:07 +07:00 committed by GitHub
commit 14c9380ddd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -73,8 +73,9 @@ pub fn main() {
);
let mut resized = false;
let scene = Scene::new(&gl, &shader_version);
event_loop.run(move |event, _, control_flow| {
let scene = Scene::new(&gl, &shader_version);
*control_flow = ControlFlow::Wait;
match event {

View file

@ -86,6 +86,8 @@ impl Scene {
pub fn draw(&self, gl: &glow::Context) {
unsafe {
gl.bind_vertex_array(Some(self.vertex_array));
gl.use_program(Some(self.program));
gl.draw_arrays(glow::TRIANGLES, 0, 3);
}
}