aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/graphics/Mesh.cpp7
-rw-r--r--src/graphics/Mesh.hpp3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/graphics/Mesh.cpp b/src/graphics/Mesh.cpp
index 64c4c7e..a4bf6b4 100644
--- a/src/graphics/Mesh.cpp
+++ b/src/graphics/Mesh.cpp
@@ -2,8 +2,9 @@
#include "Mesh.hpp"
-Mesh::Mesh(Vertex *vertices, size_t num_vert, GLuint *indices, size_t num_indices)
- : number_indices(num_indices)
+Mesh::Mesh(GLenum primitive, Vertex *vertices, size_t num_vert,
+ GLuint *indices, size_t num_indices)
+ : mode(primitive), number_indices(num_indices)
{
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
@@ -43,6 +44,6 @@ Mesh::~Mesh()
void Mesh::Draw()
{
glBindVertexArray(VAO);
- glDrawElements(GL_TRIANGLES, number_indices, GL_UNSIGNED_INT, 0);
+ glDrawElements(mode, number_indices, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
diff --git a/src/graphics/Mesh.hpp b/src/graphics/Mesh.hpp
index 577a32a..e509310 100644
--- a/src/graphics/Mesh.hpp
+++ b/src/graphics/Mesh.hpp
@@ -6,10 +6,11 @@
class Mesh {
GLuint VAO, VBO, EBO;
+ GLenum mode;
size_t number_indices;
public:
- Mesh(Vertex *vertices, size_t num_vert,
+ Mesh(GLenum primitive, Vertex *vertices, size_t num_vert,
GLuint *indices, size_t num_indices);
~Mesh();