| 44 | } |
| 45 | |
| 46 | std::string preprocess_version(const std::string & source) |
| 47 | { |
| 48 | std::stringstream input; |
| 49 | std::stringstream output; |
| 50 | |
| 51 | input << source; |
| 52 | |
| 53 | size_t lineNumber = 1; |
| 54 | std::string line; |
| 55 | std::string version; |
| 56 | |
| 57 | while (std::getline(input, line)) |
| 58 | { |
| 59 | if (line.find("#version") != std::string::npos) version = line; |
| 60 | else output << line << std::endl; |
| 61 | ++lineNumber; |
| 62 | } |
| 63 | |
| 64 | std::stringstream result; |
| 65 | result << version << std::endl << output.str(); |
| 66 | return result.str(); |
| 67 | } |
| 68 | |
| 69 | gl_shader preprocess(const std::string & vertexShader, |
| 70 | const std::string & fragmentShader, |