diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-08 17:48:05 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-08 17:48:05 +0200 |
commit | a4d66f8272c08c722a0a3fa6843ccf61e05d2928 (patch) | |
tree | 1c729736d5ee75f2e7757484929db4281dbed9a1 /engine/src | |
parent | e04add2421e98fb264dd70ff26643c9cefa9b8ad (diff) |
fix(engine): stop destroying vertex buffer before vertex array
Diffstat (limited to 'engine/src')
-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, } } } |