2015-07-16 15:17:42 +02:00

37 lines
638 B
C++

#ifndef MESH_H
#define MESH_H
#include <glew/glew.h>
#include <vector>
#include <glm/glm.hpp>
class Mesh
{
public:
typedef struct
{
glm::vec3 position;
glm::vec3 normal;
glm::vec2 texCoord;
} Vertex;
~Mesh();
void addVertex(const Vertex& v);
void addFace(int i1, int i2, int i3);
void initGL();
void destroyGL();
void draw();
bool isLocked(){return locked;}
protected:
enum {VERTEX_BUFFER, INDICES_BUFFER, NB_BUFFERS};
std::vector<Vertex> vertices;
std::vector<unsigned int> indices;
GLuint vao;
GLuint vbo[2];
bool locked;
};
#endif // MESH_H