SCV  4.2.1
Simple Components for Visual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GlslShader.h
Go to the documentation of this file.
1 
7 #ifndef __SCV_GLSLSHADER_H__
8 #define __SCV_GLSLSHADER_H__
9 
10 namespace scv {
11 
16 class GlslShader {
17 public:
18 
23  GlslShader(char *vert, char *frag);
25  static void init();
27  void setActive(bool);
31  GLint getUniformLocation(const std::string& theVar);
35  GLint getAttribLocation(const std::string& theVar);
37  static inline bool isReady(void) {
38  return _shaderReady && _initialized;
39  }
40 
41 private:
42  static bool _initialized;
43  static bool _shaderReady;
44  GLuint _program, _frag, _vert;
45  std::map<std::string, GLuint> _uniformLocations,_attribLocations;
46  void setShaders(char *vert, char *frag);
47  char *textFileRead(char *fn);
48  int printOglError(char *file, int line);
49  void printProgramInfoLog(GLuint obj);
50  void printShaderInfoLog(GLuint obj);
51 };
52 
53 } // namespace scv
54 
55 #endif // __SCV_GLSLSHADER_H__