diff options
-rw-r--r-- | engine/src/renderer/mod.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs index a339ea8..13091fd 100644 --- a/engine/src/renderer/mod.rs +++ b/engine/src/renderer/mod.rs @@ -55,6 +55,9 @@ pub struct Renderable { shader_program: crate::shader::Program, vertex_arr: VertexArray, + + /// Vertex buffer has to live as long as the vertex array + _vertex_buffer: VertexBuffers<1>, } impl Renderable @@ -74,14 +77,10 @@ impl Renderable vertex_attrib_ptr(0); enable_vertex_attrib_array(0); - unsafe { - gl::BindBuffer(gl::ARRAY_BUFFER, 0); - gl::BindVertexArray(0); - } - Self { shader_program, vertex_arr, + _vertex_buffer: vertex_buffer, } } } |