mirror of
https://github.com/IllusionMan1212/3dobs.git
synced 2026-10-24 10:12:35 +00:00
clean up opengl buffers when dropping aabb
This commit is contained in:
+15
@@ -8,6 +8,8 @@ pub struct AABB {
|
|||||||
pub max: glm::Vec3,
|
pub max: glm::Vec3,
|
||||||
indices_len: u32,
|
indices_len: u32,
|
||||||
vao: u32,
|
vao: u32,
|
||||||
|
vbo: u32,
|
||||||
|
ebo: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AABB {
|
impl AABB {
|
||||||
@@ -69,6 +71,8 @@ impl AABB {
|
|||||||
max,
|
max,
|
||||||
indices_len: indices.len() as u32,
|
indices_len: indices.len() as u32,
|
||||||
vao,
|
vao,
|
||||||
|
vbo,
|
||||||
|
ebo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,3 +92,14 @@ impl AABB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for AABB {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
gl::BindVertexArray(0);
|
||||||
|
gl::DeleteBuffers(1, &self.vbo);
|
||||||
|
gl::DeleteBuffers(1, &self.ebo);
|
||||||
|
gl::DeleteVertexArrays(1, &self.vao);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user