38 lines
825 B
C++
38 lines
825 B
C++
#ifndef GLTEST_GLOBJECT_H
|
|
#define GLTEST_GLOBJECT_H
|
|
|
|
#include "IGLObject.h"
|
|
#include "../Shaders/ShaderProgram.h"
|
|
#include "vertex.h"
|
|
|
|
#include <tuple>
|
|
#include <GL/glew.h>
|
|
|
|
class GLObject: public IGLObject {
|
|
private:
|
|
GLuint _vertexVbo;
|
|
GLuint _indexVbo;
|
|
GLuint _vao;
|
|
glm::mat4 _worldMatrix;
|
|
ShaderProgram* _sp;
|
|
GLuint _trianglesCount;
|
|
|
|
public:
|
|
GLObject(ShaderProgram *shaderProgram);
|
|
virtual ~GLObject();
|
|
|
|
void create() override final;
|
|
void rotate(glm::vec3 angles) override final;
|
|
void scale(glm::vec3 scaleFactor) override final;
|
|
void translate(glm::vec3 point) override final;
|
|
void draw() override final;
|
|
void update();
|
|
|
|
protected:
|
|
virtual std::tuple<Vertex*, std::size_t> generateVertices() const = 0;
|
|
virtual std::tuple<GLuint*, std::size_t> generateIndices() const = 0;
|
|
};
|
|
|
|
|
|
#endif //GLTEST_GLOBJECT_H
|