All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UniformColoredShader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Shader.h"
6 #include "IdTypes.h"
7 #include "Graphics.h"
8 #include "VectorMath.h"
9 #include "Rendering.h"
10 #include <string>
11 
12 namespace Eegeo
13 {
14  namespace Rendering
15  {
16  namespace Shaders
17  {
19  {
20  public:
21  static UniformColoredShader* Create(const TShaderId shaderId);
22 
23  void SetMVP(const m44& mvp) const
24  {
25  const bool transpose = false;
26  SetUniformM44(mvp, m_mvpUniformLocation, transpose);
27  }
28 
29  void SetColor(const v4& color) const
30  {
31  SetUniformV4(color, m_colorUniformLocation);
32  }
33 
34  void Use(Rendering::GLState& glState) const
35  {
36  UseProgram(glState);
37  }
38 
39  protected:
41  const TShaderId shaderId,
42  const std::string& vertexShaderCode,
43  const std::string& fragmentShaderCode);
44 
45  private:
46  GLuint m_mvpUniformLocation ;
47  GLuint m_colorUniformLocation;
48  };
49  }
50  }
51 }