summaryrefslogtreecommitdiff
path: root/shader.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-01-16 18:09:15 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-01-16 18:09:15 +0000
commit400410fcd436d5e4310bfa779f0309c5fae5b2c2 (patch)
tree89661918c487e63b6c71f2e9281b553928010606 /shader.h
downloadilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.tar.bz2
ilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.tar.xz
ilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.zip
Initial commit
Stripped back and formatted from https://github.com/BennyQBD/ModernOpenGLTutorial/
Diffstat (limited to 'shader.h')
-rw-r--r--shader.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/shader.h b/shader.h
new file mode 100644
index 0000000..bd3ac38
--- /dev/null
+++ b/shader.h
@@ -0,0 +1,36 @@
+#ifndef SHADER_INCLUDED_H
+#define SHADER_INCLUDED_H
+
+#include "transform.h"
+#include <GL/glew.h>
+#include <string>
+
+class Shader {
+public:
+ Shader(const std::string & fileName);
+
+ void Bind();
+ void Update(const Transform & transform, const Camera & camera);
+
+ virtual ~Shader();
+
+protected:
+private:
+ static const unsigned int NUM_SHADERS = 2;
+ static const unsigned int NUM_UNIFORMS = 3;
+ void
+ operator=(const Shader & shader)
+ {
+ }
+ Shader(const Shader & shader) { }
+
+ 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, unsigned int type);
+
+ GLuint m_program;
+ GLuint m_shaders[NUM_SHADERS];
+ GLuint m_uniforms[NUM_UNIFORMS];
+};
+
+#endif