36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef SHADERPROGRAM_H
 | |
| #define SHADERPROGRAM_H
 | |
| 
 | |
| #include <GL/glew.h>
 | |
| #include <GLFW/glfw3.h>
 | |
| #include <string>
 | |
| #include <glm/glm.hpp>
 | |
| 
 | |
| namespace djalim {
 | |
|     class ShaderProgram {
 | |
|         public:
 | |
|         ShaderProgram();
 | |
|         ~ShaderProgram();
 | |
| 
 | |
|         bool loadShaders(const char* vertexShaderFile, const char* fragmentShaderFile);
 | |
|         void use();
 | |
| 
 | |
|         void setUniform(const std::string& name, float value);
 | |
|         void setUniform(const std::string& name, int value);
 | |
|         void setUniform(const std::string& name, const glm::vec2& value);
 | |
|         void setUniform(const std::string& name, const glm::vec3& value);
 | |
|         void setUniform(const std::string& name, const glm::vec4& value);
 | |
|         void setUniform(const std::string& name, const glm::mat4& value);
 | |
| 
 | |
|         GLuint getProgram() const { return mHandle; }
 | |
| 
 | |
|         private:
 | |
|         std::string fileToString(const std::string& filename);
 | |
|         void checkCompileErrors(GLuint shader, std::string type);
 | |
| 
 | |
|         GLuint mHandle;
 | |
|     };
 | |
| }
 | |
| 
 | |
| #endif // SHADERPROGRAM_H
 |