summaryrefslogtreecommitdiff
path: root/shader.h
blob: bd3ac3869fe7f4f73840ab470d4406a050402a1c (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
30
31
32
33
34
35
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