diff options
Diffstat (limited to 'shader.h')
-rw-r--r-- | shader.h | 37 |
1 files changed, 17 insertions, 20 deletions
@@ -1,36 +1,33 @@ #ifndef SHADER_INCLUDED_H
#define SHADER_INCLUDED_H
-#include "transform.h"
#include <GL/glew.h>
+#include <array>
#include <string>
+class Camera;
+class Transform;
+
class Shader {
public:
- Shader(const std::string & fileName);
-
- void Bind();
- void Update(const Transform & transform, const Camera & camera);
-
+ explicit Shader(const std::string & fileName);
virtual ~Shader();
+ void operator=(const Shader &) = delete;
+ Shader(const Shader &) = delete;
+
+ void Bind() const;
+ void Update(const Transform & transform, const Camera & camera) const;
-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);
+ static constexpr unsigned int NUM_SHADERS = 2;
+ static constexpr unsigned int NUM_UNIFORMS = 3;
+
+ static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, const std::string & errorMessage);
+ static GLuint CreateShader(const GLchar * text, GLint len, unsigned int type);
GLuint m_program;
- GLuint m_shaders[NUM_SHADERS];
- GLuint m_uniforms[NUM_UNIFORMS];
+ std::array<GLuint, NUM_SHADERS> m_shaders;
+ std::array<GLint, NUM_UNIFORMS> m_uniforms;
};
#endif
|