summaryrefslogtreecommitdiff
path: root/engine/src/renderer/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r--engine/src/renderer/mod.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index 364b7f4..a23d5a0 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -45,7 +45,9 @@ pub fn render<'renderable>(renderables: impl IntoIterator<Item = &'renderable Re
for renderable in renderables {
renderable.shader_program.activate();
- renderable.vertex_arr.draw(PrimitiveKind::Triangles, 0, 3);
+ renderable.vertex_arr.bind(|vert_arr_curr_bound| {
+ VertexArray::draw(&vert_arr_curr_bound, PrimitiveKind::Triangles, 0, 3);
+ });
}
}
@@ -64,14 +66,15 @@ impl Renderable
pub fn new(shader_program: crate::shader::Program, vertices: &[Vertex]) -> Self
{
let vertex_arr = VertexArray::new();
-
- vertex_arr.bind();
-
let vertex_buffer = VertexBuffer::new();
- vertex_buffer.store(vertices, BufferUsage::Static);
+ vertex_arr.bind(|vert_arr_curr_bound| {
+ vertex_buffer.bind(|vert_buf_curr_bound| {
+ VertexBuffer::store(&vert_buf_curr_bound, vertices, BufferUsage::Static);
- VertexArray::configure_attrs();
+ VertexArray::configure_attrs(&vert_arr_curr_bound, &vert_buf_curr_bound);
+ });
+ });
Self {
shader_program,