diff --git a/src/graphics/core/Mesh.cpp b/src/graphics/core/Mesh.cpp index c8c114c2..e0cc5484 100644 --- a/src/graphics/core/Mesh.cpp +++ b/src/graphics/core/Mesh.cpp @@ -21,8 +21,8 @@ Mesh::Mesh(const MeshData& data) Mesh::Mesh(const float* vertexBuffer, size_t vertices, const int* indexBuffer, size_t indices, const vattr* attrs) : ibo(0), - vertices(vertices), - indices(indices) + vertices(0), + indices(0) { meshesCount++; vertexSize = 0; @@ -74,7 +74,7 @@ void Mesh::reload(const float* vertexBuffer, size_t vertices, const int* indexBu this->indices = indices; } -void Mesh::draw(unsigned int primitive){ +void Mesh::draw(unsigned int primitive) const { drawCalls++; glBindVertexArray(vao); if (ibo != 0) { @@ -86,6 +86,6 @@ void Mesh::draw(unsigned int primitive){ glBindVertexArray(0); } -void Mesh::draw() { +void Mesh::draw() const { draw(GL_TRIANGLES); } diff --git a/src/graphics/core/Mesh.hpp b/src/graphics/core/Mesh.hpp index 87c8e69b..b36b044d 100644 --- a/src/graphics/core/Mesh.hpp +++ b/src/graphics/core/Mesh.hpp @@ -28,10 +28,10 @@ public: /// @brief Draw mesh with specified primitives type /// @param primitive primitives type - void draw(unsigned int primitive); + void draw(unsigned int primitive) const; /// @brief Draw mesh as triangles - void draw(); + void draw() const; /// @brief Total numbers of alive mesh objects static int meshesCount;