summaryrefslogtreecommitdiff
path: root/gfx/models/mesh.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 14:10:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-22 14:10:34 +0000
commit20646758939562c0fbad4d52774efcfacf7e22fc (patch)
tree9bd582b749640206a5e38389117d6c931dcf1f5f /gfx/models/mesh.h
parentInitial commit with some basic UI (diff)
downloadilt-20646758939562c0fbad4d52774efcfacf7e22fc.tar.bz2
ilt-20646758939562c0fbad4d52774efcfacf7e22fc.tar.xz
ilt-20646758939562c0fbad4d52774efcfacf7e22fc.zip
RAII for glVertex and glBuffer
Diffstat (limited to 'gfx/models/mesh.h')
-rw-r--r--gfx/models/mesh.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h
index c9f1204..4e6cec8 100644
--- a/gfx/models/mesh.h
+++ b/gfx/models/mesh.h
@@ -2,30 +2,22 @@
#define MESH_INCLUDED_H
#include <GL/glew.h>
-#include <array>
+#include <glBuffers.h>
+#include <glVertexArrays.h>
#include <memory>
#include <span>
-#include <special_members.hpp>
class Vertex;
-enum MeshBufferPositions { POSITION_VB, TEXCOORD_VB, NORMAL_VB, INDEX_VB };
-
class Mesh {
public:
Mesh(const std::span<const Vertex> vertices, const std::span<const unsigned int> indices, GLenum = GL_TRIANGLES);
- virtual ~Mesh();
-
- NO_COPY(Mesh);
- NO_MOVE(Mesh);
void Draw() const;
private:
- static constexpr unsigned int NUM_BUFFERS {4};
-
- GLuint m_vertexArrayObject;
- std::array<GLuint, NUM_BUFFERS> m_vertexArrayBuffers;
+ glVertexArray m_vertexArrayObject;
+ glBuffers<2> m_vertexArrayBuffers;
GLsizei m_numIndices;
GLenum mode;
};