12345678910111213141516171819202122232425262728293031 |
- #ifndef SHADERPROGRAM_H
- #define SHADERPROGRAM_H
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include <iostream>
- using namespace std;
- class ShaderProgram
- {
- public:
- ShaderProgram();
- virtual ~ShaderProgram();
-
- void compile(const GLchar* vertexPath, const GLchar* fragmentPath);
- bool isValid() const;
- GLuint getProgram() const;
- private:
- GLchar* readFile(const GLchar* name);
- bool checkShaderErrors(const GLchar* name, GLuint shader);
- void compile(const GLchar* vertexPath, const GLchar* vertexData, const GLchar* fragmentPath, const GLchar* fragmentData);
-
- GLuint vertexShader = 0;
- GLuint fragmentShader = 0;
- GLuint program = 0;
- bool valid = false;
- };
- #endif
|