commit 6ff073375b82913ee5717cf15c528a011a5fd83c parent 0ac170017b42ffa341045049dabddc33e2ae4bb6 Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Oct 29 13:50:43 +0300 Add renderer_delete_mesh Diffstat:
bsp_renderer.cc | | | 4 | +++- |
renderer.cc | | | 3 | ++- |
renderer.h | | | 1 | + |
diff --git a/bsp_renderer.cc b/bsp_renderer.cc @@ -136,5 +136,7 @@ void bspr_render( const BSPRenderer * bspr, v3 pos, const RenderState & render_s void bspr_destroy( BSPRenderer * bspr ) { memarena_clear( bspr->arena ); - // TODO + for( u32 i = 0; i < bspr->bsp->num_leaves; i++ ) { + renderer_delete_mesh( bspr->meshes[ i ] ); + } } diff --git a/renderer.cc b/renderer.cc @@ -236,7 +236,8 @@ Mesh renderer_new_mesh( MeshConfig config ) { } void renderer_delete_mesh( const Mesh & mesh ) { - glDeleteVertexArrays( 1, &mesh.vao ); + GLuint vao = checked_cast< GLuint >( mesh.vao ); + glDeleteVertexArrays( 1, &vao ); } static GLenum primitivetype_to_glenum( PrimitiveType primitive_type ) { diff --git a/renderer.h b/renderer.h @@ -127,5 +127,6 @@ void renderer_delete_shader(); Mesh renderer_new_mesh( MeshConfig config ); void renderer_draw_mesh( Mesh mesh, RenderState state ); +void renderer_delete_mesh( Mesh mesh ); #endif // _RENDERER_H_