You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Shader.h 581B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef SHADER_H
  2. #define SHADER_H
  3. #include <GL/glew.h>
  4. #include <string>
  5. #include <map>
  6. struct VertexShader {
  7. VertexShader(std::string n) : name(n) { }
  8. std::string name;
  9. };
  10. struct FragmentShader {
  11. FragmentShader(std::string n) : name(n) { }
  12. std::string name;
  13. };
  14. class Shader {
  15. public:
  16. enum Type {
  17. Vertex,
  18. Fragment
  19. };
  20. Shader(unsigned int h) : handle(h) { }
  21. void bind() const;
  22. void release() const;
  23. unsigned int handle;
  24. int uniform(const std::string &name);
  25. int attribute(const std::string &name);
  26. private:
  27. std::map<std::string, int> locationMap;
  28. };
  29. #endif