| 28 | } |
| 29 | |
| 30 | std::string getSource(const std::string& sourceFile, const std::string& type) |
| 31 | { |
| 32 | std::ifstream inFile ("Data/Shaders/" + sourceFile + "_" + type + ".glsl"); |
| 33 | std::string source; |
| 34 | std::stringstream stringStream; |
| 35 | |
| 36 | if (!inFile.is_open()) |
| 37 | { |
| 38 | throw std::runtime_error ("Could not open shader file: " + sourceFile); |
| 39 | } |
| 40 | |
| 41 | stringStream << inFile.rdbuf(); |
| 42 | source = stringStream.str(); |
| 43 | |
| 44 | return source; |
| 45 | } |
| 46 | |
| 47 | GLuint createProgram(GLuint vertexShaderID, GLuint fragmentShaderID) |
| 48 | { |