From 3efd3026d22c71e95a853985f3f50f52147d287e Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Sun, 13 Oct 2024 23:46:06 -0400 Subject: Instanced rendering, mouse move event --- src/mesh.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mesh.rs') diff --git a/src/mesh.rs b/src/mesh.rs index 2f54903..aba9957 100644 --- a/src/mesh.rs +++ b/src/mesh.rs @@ -115,4 +115,11 @@ impl Mesh { ctx.gl.draw_elements(glow::TRIANGLES, self.index_count as _, glow::UNSIGNED_INT, 0); } } + + pub fn render_instanced(&self, ctx: &context::Context, count: u64) { + unsafe { + ctx.gl.bind_vertex_array(Some(self.vao)); + ctx.gl.draw_elements_instanced(glow::TRIANGLES, self.index_count as _, glow::UNSIGNED_INT, 0, count as _); + } + } } -- cgit v1.2.3