summaryrefslogtreecommitdiff
path: root/inc/geoshader.hpp
blob: f8be43bb446c5fef3d91547a53320c7bbde2b19b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef geoshader_h
#define geoshader_h

#include <string>
#include <GL/glew.h>
#include "graphicsobjects.hpp"

//#define GLSL(src) "#version 150 core\n" #src

class GeoShader
{
  public:
    GeoShader(const std::string& fileName);

    void Bind();
    void Update(const Transform& transform, const Camera& camera);
    virtual ~GeoShader();
    GLuint m_program;

  private:
    static const unsigned int NUM_SHADERS = 3;
    static const unsigned int NUM_UNIFORMS = 3;
    std::string LoadShader(const std::string& fileName);
    void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, const std::string& errorMessage);
    GLuint CreateShader(const std::string& text, GLenum shaderType);

    GLuint m_shaders[NUM_SHADERS];
    GLuint m_uniforms[NUM_UNIFORMS];
};

#endif