aboutsummaryrefslogtreecommitdiffstats
path: root/include/glsl_program.hpp
blob: 98a47e3ebcc3f7b963c6b2095bbc1a6f5029b937 (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
#ifndef GLSL_PROGRAM_HPP
#define GLSL_PROGRAM_HPP

#include <GL/glew.h>
#include <string>

class GlslProgram
{
private:
    GLuint program_id_ = 0;
    GLuint vertex_shader_id_ = 0;
    GLuint fragment_shader_id_ = 0;
    int attribute_index_ = 0;

    void compileShader(const GLuint &shader, const std::string &file_path);
public:
    GlslProgram();
    ~GlslProgram();

    void compileShaders(const std::string &vertex_shader_path, const std::string &fragment_shader_path);
    void linkShaders();
    void addAttribute(const std::string &attribute_name);
    GLint getUniformLocation(const std::string &uniform_name);
    void use();
    void unuse();
};


#endif