diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-13 14:29:23 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-13 14:29:23 +0200 |
commit | d109fa83bd9678fc3c9e21da48e90aa069ec1c7f (patch) | |
tree | 69d893868806d90bbbd5bf2ea36603616fa2e70b /draw | |
parent | 67897701316d83495aed4baa94e96c9f84b818f8 (diff) |
a
Diffstat (limited to 'draw')
-rw-r--r-- | draw/floor-mesh.cpp | 1 | ||||
-rw-r--r-- | draw/wall-mesh.cpp | 1 | ||||
-rw-r--r-- | draw/wireframe-mesh.cpp | 2 | ||||
-rw-r--r-- | draw/wireframe-mesh.hpp | 1 |
4 files changed, 4 insertions, 1 deletions
diff --git a/draw/floor-mesh.cpp b/draw/floor-mesh.cpp index da8fe7f2..4c23a391 100644 --- a/draw/floor-mesh.cpp +++ b/draw/floor-mesh.cpp @@ -32,6 +32,7 @@ void floor_mesh::set_tile(quad_data& data, tile& x) void floor_mesh::draw(tile_shader& shader, chunk& c) { + _vertex_buffer.setData({nullptr, sizeof(quad_data) * TILE_COUNT}, Magnum::GL::BufferUsage::DynamicDraw); // orphan the buffer std::array<quad_data, TILE_COUNT> data; for (auto& [x, idx, pt] : c) { set_tile(data[idx], x); diff --git a/draw/wall-mesh.cpp b/draw/wall-mesh.cpp index acd4ac75..81201598 100644 --- a/draw/wall-mesh.cpp +++ b/draw/wall-mesh.cpp @@ -39,6 +39,7 @@ void wall_mesh::maybe_add_tile(vertex_array& data, texture_array& textures, tile void wall_mesh::draw(tile_shader& shader, chunk& c) { + _vertex_buffer.setData({nullptr, sizeof(vertex_array)}, Magnum::GL::BufferUsage::DynamicDraw); // orphan the buffer texture_array textures = {}; { vertex_array data; diff --git a/draw/wireframe-mesh.cpp b/draw/wireframe-mesh.cpp index 32aa72aa..0b6846d7 100644 --- a/draw/wireframe-mesh.cpp +++ b/draw/wireframe-mesh.cpp @@ -29,7 +29,7 @@ GL::RectangleTexture mesh_base::make_constant_texture() mesh_base::mesh_base(GL::MeshPrimitive primitive, Containers::ArrayView<const void> index_data, std::size_t num_vertices, std::size_t num_indexes) : - _vertex_buffer{Containers::Array<Vector3>{ValueInit, num_vertices}}, + _vertex_buffer{Containers::Array<Vector3>{ValueInit, num_vertices}, GL::BufferUsage::DynamicDraw}, _texcoords_buffer{Containers::Array<Vector2>{ValueInit, num_vertices}}, _index_buffer{num_indexes == 0 ? GL::Buffer{NoCreate} : GL::Buffer{index_data}} { diff --git a/draw/wireframe-mesh.hpp b/draw/wireframe-mesh.hpp index 3c0deb37..6c1a7d3f 100644 --- a/draw/wireframe-mesh.hpp +++ b/draw/wireframe-mesh.hpp @@ -55,6 +55,7 @@ wireframe_mesh<T>::wireframe_mesh() : template <wireframe::traits T> void wireframe_mesh<T>::draw(tile_shader& shader, T x) { + _vertex_buffer.setData({nullptr, sizeof(Vector3) * T::num_vertices}, GL::BufferUsage::DynamicDraw); // orphan the buffer _vertex_buffer.setSubData(0, x.make_vertex_array()); x.on_draw(); mesh_base::draw(shader); |