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.

ShaderLoader.h 958B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef SHADERLOADER_H
  2. #define SHADERLOADER_H
  3. #include <GL/glew.h>
  4. #include <string>
  5. #include <map>
  6. #include "Shader.h"
  7. class ShaderLoader {
  8. public:
  9. using ShaderCache = std::map<std::string, Shader*>;
  10. // Get a shader from the shader cache and load it from disk it isn't there
  11. Shader *getShader(VertexShader vertexShader, FragmentShader fragmentShader);
  12. // Load a shader from disk and return the its handle
  13. GLuint loadShader(const std::string &shader, Shader::Type shaderType);
  14. GLuint createProgram(const std::string &shader1Name, Shader::Type shader1Type,
  15. const std::string &shader2Name, Shader::Type shader2Type);
  16. private:
  17. ShaderCache shaderCache;
  18. int checkProgram(GLuint program, GLenum programName,
  19. const std::string &shaderName);
  20. int checkShader(GLuint shader, const std::string &shaderName, Shader::Type shaderType);
  21. GLenum getGlShaderType(const Shader::Type type);
  22. const char *getProgramStatusString(GLenum pname);
  23. };
  24. #endif